上一页 1 ··· 5 6 7 8 9 10 11 下一页
摘要: 1 #include 2 #include 3 #include 4 5 #define LEN sizeof(struct student) 6 7 struct student{ 8 long num; 9 float score; 10 stru... 阅读全文
posted @ 2013-10-25 17:02 Andy Cheung 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 1.新建算法:使p1指向新开辟的结点,p2指向链表中最后一个结点,把p1所指的结点连接在p2所指结点的后面,用“p2->next=p1”来实现。 1 #include 2 #include 3 #include 4 5 #define LEN sizeof(struct student) 6 7... 阅读全文
posted @ 2013-10-23 16:49 Andy Cheung 阅读(455) 评论(1) 推荐(0) 编辑
摘要: 例子:从键盘输入若干行字符(每行长度不等),输入后把它们存储到一磁盘文件中。再从该文件中读入这些数据,将其中小写字母转换成大写字母后再显示屏上输出。有两种方法1.使用feof()函数 1 #include 2 #include 3 #include 4 5 int main(){ 6 se... 阅读全文
posted @ 2013-10-22 10:23 Andy Cheung 阅读(3794) 评论(0) 推荐(0) 编辑
摘要: 使用书上的一个课后题为例有5个学生,每个学生有3门课的成绩,从键盘输入学生数据(包括学号,姓名,3们课程成绩),计算出每个学生的平均成绩,将原有数据和计算出的平均分数存放在磁盘文件“stud”中。屡次调试后,我编好的程序: 1 #include 2 #include 3 #define FWRITE... 阅读全文
posted @ 2013-10-21 10:54 Andy Cheung 阅读(3189) 评论(3) 推荐(0) 编辑
摘要: 课本上时这样写的:(用putchar(ch);代表对取出来的字符的处理。)1 while(!feof(fp))2 {3 ch=fgetc(fp);4 putchar(ch);5 }但是,这样写的话,fgetc()函数总是会多读入一个字符。应该改为如下形式:1 ch=fgetc(fp)... 阅读全文
posted @ 2013-10-20 21:24 Andy Cheung 阅读(1991) 评论(2) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 4 int main(){ 5 setbuf(stdout,NULL); 6 int move(int,int); 7 int value,n; 8 int result; 9 10 printf("Input the value:\n");11 scanf("%x",&value);12 13 printf("How to move?\n");14 scanf("%d",&n);15 16 result=move(value,n);17 printf 阅读全文
posted @ 2013-10-18 21:41 Andy Cheung 阅读(1619) 评论(0) 推荐(0) 编辑
摘要: 1.先贴我的代码,VC6.0开发环境下去掉第5行。 1 #include 2 #include 3 4 int main(){ 5 setvbuf(stdout,NULL,_IONBF,0); 6 int value; 7 int getodds(int value); 8 9 printf("Input the value:");10 scanf("%o",&value);11 12 printf("The result is %o.",getodds(value));13 14 return EXIT_SUCCESS;15 阅读全文
posted @ 2013-10-18 17:35 Andy Cheung 阅读(5442) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 4 int main(){ 5 setvbuf(stdout,NULL,_IONBF,0); 6 char s1[255],s2[255]; 7 int strcmp(char *,char *); 8 int result; 9 10 printf("1st string:");11 gets(s1);12 printf("2nd string:");13 gets(s2);14 result=strcmp(s1,s2);15 printf("The compa... 阅读全文
posted @ 2013-10-16 11:21 Andy Cheung 阅读(3839) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeint main(){ setvbuf(stdout,NULL,_IONBF,0); char s[255]; int a[255]; //存放得到的整数 int i,length; ... 阅读全文
posted @ 2013-10-16 09:41 Andy Cheung 阅读(7238) 评论(0) 推荐(0) 编辑
摘要: #include#includeint main(){ setvbuf(stdout,NULL,_IONBF,0); int a[5][5]; int i,j; void process(int *a); printf("Input the matrix:\n"); for(i=0;ia[max]) max=i; if(max!=12) { t=a[max]; a[max]=a[12]; a[12]=t; } //寻找4个小数,放四角 for(i=0;i<4;i++... 阅读全文
posted @ 2013-10-14 16:35 Andy Cheung 阅读(3139) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 下一页