?? 統計文件字符數.cpp
字號:
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
void main ()
{
fstream file;
file.open("abc.txt",ios::in);
if (!file)
{
cout <<"abc.txt can't open"<<endl;
abort();
}
char ch;
int i=0;
while (!file.eof())
{
file.get(ch);
i++;
}
cout <<"文件的字符數是:"<<i<<endl;
file.close();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -