#include <iostream>
#include <fstream>
using namespace std;
int main(){
fstream filename;
int num = 0;
char c;
filename.open("test.txt", ios::in);
while (!filename.eof()) {
filename >> c;
num++;
}
filename.close();
cout << num << endl;
return 0;
}
编写一个程序,它打开一个文本文件,逐个字符地读取该文件,直到到达文件末尾,然后指出该文件中包含多少个字符
发布时间 2023-12-14 15:15:57作者: wshidaboss