读取a.txt中文本,统计文本中字母数量
哈哈哈哈哈🤣🤣🤣,先容我笑会,CSDN 还有其他的地方不是有很多吗
或者直接使用上面的这个,我刚用VS2019编译了,可以成功,input.txt,在C文件同级目录
#include <iostream>#include <iomanip>#include <fstream>using namespace std;int main(){ ifstream fin("input.txt"); if(!fin) { cout << "file error!"<<endl; exit(0); } char str; int count = 0; while(!fin.eof()) { fin >> str; if(( str >= 'a' && str <= 'z' ) || ( str >= 'A' && str <= 'Z' )) { ++count; } } fin.close(); cout << "the engish is " << count << endl; return 0;}追问编译错误,过不了