C语言,高手进

来源:百度知道 编辑:UC知道 时间:2024/05/18 11:33:24
这个程序怎么编啊..
1、在网上随便找一片有一定长度的英文文章,保存成文本格式,
2、编写程序写成一下工作:
读取该文本,统计文本中单词和句子的数目,并在屏幕上输出该文本,每行输出一个句子,同时把文本内容输出到另一个文本文档中,每行输出一个句子.
谢谢~~~~~~~~~~高手帮帮忙啊
看不太懂,帮忙注释一下嘛..谢谢咯嘛,

#include <map>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <cstddef>
#include <iomanip>
using namespace std;

int main()
{
string fileName;

cout << "请输入要读入文件的名称: ";
cin >> fileName;
ifstream inFile(fileName.c_str());

if(!inFile)
throw;

cout << "请输入要存入文件的名称: ";
cin >> fileName;
ofstream outFile(fileName.c_str());

if(!outFile)
throw;

string contents;
inFile.unsetf(ios_base::skipws);
char c;
while(inFile >> c)
{
contents.push_back(c);
}
inFile.clear();
inFile.seekg(ios_base::beg);

while(contents.find_first_of(".,!?:{}\"':></+=|\\_-)(@#$%^&*0123456789") != string::npos)
{
contents.erase(conten