📄 wordcount.cpp
字号:
///////////// wordcount.cpp ///////////////
#include <iostream>
#include <fstream.h>
//#include "file.cpp"
#include "wordcount.h"
//using namespace std;
char c_temp;
//写文件
void write_file( char ch )
{
fstream file;
file.open("data.txt",ios::app);
file<<ch;
file.close();
}
bool wordcount::readin()
{
char c;
while ( ! buf->isFull() )
if ( std::cin.get(c) )
{
buf->produce(c);
write_file(c);
if ( c == '#' && c_temp == '/')
return false;
c_temp=c;
}
else
return false;
return true;
}
void wordcount::count()
{
int c;
while ( ! buf->isEmpty() )
switch( c=buf->consume() )
{
case ' ':
case '\t':
case '\n':
if ( word ) wcnt++;
word=false;
break;
default:
word=true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -