最新评论
re: .NET中的内存管理 孤剑 2009-03-18 22:29
总结的不错,记录一下。
re: 一些链接 LGX.NET 2007-06-07 11:34
re: 一些链接 LGX.NET 2007-06-05 13:17
re: 一些链接 LGX.NET 2007-04-30 09:55
asp.net分层程序设计
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416
ajax分层程序设计
http://www.codeproject.com/ajax/ajaxwebapp.asp
.net的属性应用
http://www.spaanjaars.com/QuickDocId.aspx?quickdoc=390
Nhibernate1.2介绍
http://www.codeproject.com/aspnet/NHibernateBestPractices.asp
SmartCode-An Open Source Code Generator
http://www.codeproject.com/useritems/SmartCode-Code_Generation.asp
re: c入门 LGX.NET 2007-04-28 13:39
在 vs2005中引用 #include "iostream.h"
要改为
#include <iostream>
using namespace std;
re: c入门 LGX.NET 2007-04-27 14:17
/****简单链表*****/
#include <stdlib.h>
#include <stdio.h>
struct node
{
int num;
struct node *next;
};
main()
{
struct node *creat();
void print();
struct node *head;
head=NULL;
head =creat(head);
print(head);
}
struct node * creat(struct node *head)
{
struct node *p1,*p2;
p1=p2=(struct node *) malloc(sizeof(struct node));
printf("input int:\n");
scanf("%d",&p1->num);
p1->next = NULL;
while(p1->num>0)
{
if(head==NULL)head=p1;
else p2->next=p1;
p2=p1;
p1 = (struct node *)malloc(sizeof(struct node));
scanf("%d",&p1->num);
}
return head;
}
void print(struct node *head)
{
struct node *temp;
temp = head;
while(temp!=NULL)
{
printf("%6d",temp->num);
temp = temp->next;
}
}
re: c入门 LGX.NET 2007-04-26 14:38
/*****结构体指针******/
#include <stdlib.h>
struct data
{
int day,month,year;
};
struct stu
{
char name[20];
long num;
struct data birthday;
};
main()
{
int i;
struct stu *p,student[4]={{"liying",1,1989,2,21},{"fdsfds",2,1967,5,32},
{"fhdskj",3,1945,3,3},{"kjlk",4,1967,12,31}};
p = student;
printf("\n1---------output name ,number,year,month,day-------------\n");
for(i=0;i<4;i++)
{
printf("%20s%10ld//%d//%d//%d\n",(p+i)->name,(p+i)->num,(p+i)->birthday.year,(p+i)->birthday.month,(p+i)->birthday.day);
}
printf("\n2---------output name ,number,year,month,day-------------\n");
for(i=0;i<4;i++,p++)
{
printf("%20s%10ld//%d//%d//%d\n",p->name,p->num,p->birthday.year,p->birthday.month,p->birthday.day);
}
printf("\n3---------output name ,number,year,month,day-------------\n");
for(i=0;i<4;i++)
{
printf("%20s%10ld//%d//%d//%d\n",student[i].name,student[i].num,student[i].birthday.year,student[i].birthday.month,student[i].birthday.day);
}
scanf("%d",&i);
}
re: c入门 LGX.NET 2007-04-25 22:50
/*****结构体使用*****/
#include <stdio.h>
#include <stdlib.h>
struct stu
{
char name[20];//姓名
long number;//学号
float score[4];//数组依次存放English,Mathema,Physice及Average
};
main()
{
void input();
void aver();
void output();
struct stu arr[2];
input(arr,2);
aver(arr,2);
output(arr,2);
}
void input(arr,n)//输入类型数组arr的n个元素
struct stu arr[];
int n;
{
int i,j;
char temp[30];
for(i=0;i<n;i++)
{
/*
int atoi(char *str) 转换str所指向的字符串为实型
double atof(char *str)转为实型
long atol(char *str)转为长整形
*/
printf("\ninput name,number,English,mathema,physic\n");
gets(arr[i].name);
gets(temp);
arr[i].number = atol(temp);
for(j=0;j<3;j++)
{
gets(temp);
arr[i].score[j] = atoi(temp);
}
}
}
void aver(arr,n)
int n;
struct stu arr[];
{
int i,j;
int temp=0;
for(i=0;i<n;i++)
{
for(j=0;j<3;j++)
{
temp = temp+arr[i].score[j];
}
arr[i].score[3] = temp/3;
temp = 0;
}
}
void order(arr,n)
int n;
struct stu arr[];
{
int i,j;
struct stu temp;
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1-i;j++)
{
if(arr[j].score[3]>arr[j+1].score[3])
{
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1]=temp;
}
}
}
}
void output(arr,n)
int n;
struct stu arr[];
{
int i,j;
printf("*******************TABLE**********************\n");
printf("----------------------------------------------\n");
printf("|%10s|%8s|%7s|%7s|%7s|%7s|\n","Name","Number","English","Mathema","Physics","Average");
printf("----------------------------------------------\n");
for(i=0;i<n;i++)
{
printf("|%10s|%8ld|",arr[i].name,arr[i].number);
for(j=0;j<4;j++)
{
printf("%7.2f",arr[i].score[j]);
}
printf("\n");
printf("-------------------------------------------\n");
}
scanf("%d",&i);
}
re: c入门 LGX.NET 2007-04-18 23:31
//定义结构体
struct stu
{
char name[20];
char sex;
long num;
float score[3];
};
//定义结构体变量
struct stu student1,student2;
//结构体初始化
struct stu student={"lingpi","f",58725,98,76,87}
//定义结构体同时定义结构体变量
struct data
{
int day;
int month;
int year;
}time1,time2;
re: c入门 LGX.NET 2007-04-11 21:07
指针
#include <stdio.h>
int main()
{
int *p,m;
m=3;
p=&m;
printf("p:%d,m:%d\n",p,m);
printf("*p:%d,&m:%d",*p,&m);
scanf("%d",&m);
}
//--------------
p:1245012,m:3
*p:3,&m:1245012
re: c入门 LGX.NET 2007-04-11 20:30
#include <stdio.h>
int main()
{
int y;
printf("%d",f(7));
scanf("%d",&y);
}
/*Fibonacci数列 递归解法
0,1,1,2,3,5,8,13,....
*/
int f(int n)
{
if(n==0) return 0;
else if(n==1) return 1;
else return f(n-1)+f(n-2);
}