some cpp files

类别:编程语言 点击:0 评论:0 推荐:

#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
  string word;
  int retval=0;
  ofstream outfile("outfile.txt");
  ifstream infile("infile.txt");
  if(!outfile) {
          cerr << "can not create outfile."<<endl;
          retval = -1;
  }
  if(!infile) {
          cerr << "can not create infile."<<endl;
          retval = -1;
  }
  while (infile >> word) {
          outfile << word << ' ';
  }

  system("PAUSE"); 
  return retval;
}

本文地址:http://com.8s8s.com/it/it27844.htm