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); }