count1.cpp
来自「C语言命令行编程源代码」· C++ 代码 · 共 48 行
CPP
48 行
// count1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "fstream.h"
#include "stdlib.h"
//#include "console.h"
int main(int argc, char* argv[])
{
if(argc==1)
{
cerr<<"usage:"<<argv[0]<<"filename[s]\n";
exit(1);
}
ifstream fin;
ofstream fout("flash");
long count;
long total=0;
char ch;
if(fout.fail())
{
cerr<<" your bag is very heavy!";
exit(1);
}
fout<<"***********************************";
for(int file = 1; file <argc; file++)
{
fin.open("fat.bat");
//_asm("XOR AL,AL");
count=0;
while(fin.get(ch))
count++;
cout<<count<<"characters in"<<"fat.bat"<<"\n";
total+=count;
fin.clear();
fin.close();
}
cout<<total<<"character in all files\n";
puts("END!");
printf("Hello World!\n");
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?