10.27 读换行

#include <stdio.h> #include <process.h> #include <iostream.h> #include <memory.h> #include <string.h> #include <iostream.h> #include <fstream.h> void main() { FILE *fp; int count=0; char *str="\n"; char buff[256]; fp=fopen("1.txt","r"); while(fgets(buff,256,fp)!=NULL) { if (strcmp(str,buff)==0) { count++; } } cout<<count<<endl; fclose(fp); }

posted @ 2012-10-28 02:40  MFT  阅读(127)  评论(0编辑  收藏  举报