今天学习C语言,当然用的也是C语言程序这本书,这本书写得比较好,比谭浩强的书更能深入学习C语言。
今天学到文件复制这儿。
1.5.1 文件复制
先上代码
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ main () { int c; // c =getchar();//这是初始代码 // while (c !=EOF){ // putchar(c); // c=getchar();// // } while((c=getchar())!=EOF) putchar(c);//这是更加简洁的代码 //c=EOF; // putchar(c); }
这段程序的意思,是输入一个字符,然后在屏幕上打印出来,并复制打印出来。
文章评论