⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch01.1.5.1.c

📁 适合中高级学习的人参考使用的c++程序代码
💻 C
字号:
// #include <iostream>
// #include <fstream>

#include <iostream.h>
#include <fstream.h>
#include <string>

/**
 ** 
 stanl@john:d.01 264 : xsh32 ch01.1.5.1.c
 **
 stanl@john:d.01 267 : cat input_file
 Shyly, she asks, "I mean, Daddy, is there?"
 **
 stanl@john:d.01 265 : a.out
 **
 stanl@john:d.01 266 : cat out_file
 Shyly, she asks, "I mean, Daddy, is there?" 
 **
 **/

int main()
{
 	ofstream outfile( "out_file" );
 	ifstream infile( "input_file" );

 	if ( ! infile ) {
    		cerr << "error: unable to open input file!\n";
    		return -1;
 	}

 	if ( ! outfile ) {
    		cerr << "error: unable to open output file!\n";
    		return -2;
   	}

   	string word;
   	while ( infile >> word )
         	outfile << word << ' ';

   	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -