[求助]如何用文本输入输出
											怎么将一个程序输入,输出用文件保存::::要加什么语句~!~!~!
使用fstream文件输入和输出
为了打开一个文件供输入或输出,除了iostream头文件外,还必须包含头文件: 
#include <fstream> 
  
为了打开一个头文件,我们必须声明一个ofstream类型的对象: 
ofstream outfile( “ name-of-file” ); 
  
为了测试是否已经成功地打开了一个文件,我们可以这样写: 
if ( !outfile ) 
    cerr << “Sorry! We were unable to open the file!\n” ; 
  
类似地,为了打开一个文件供输入,我们必须声明一个ifstream类型的对象: 
ifstream infile ( “name of file “ ); 
if ( ! infile ) 
    cerr << “Sorry! We were unable to open the file!\n” ; 
using namespace std;
把 std 名字空间所有在iostream文件中定义的名称导入到全局名字空间中,使它们在全局范围内有效。引用 std 空间的任何名称时无须指定名字域 std ,而可以象引用全局名称一样使用。
如 std::endl ,在使用 using namespace std;语句后,std::endl 在全局域内,使用它,直接使用其名字 endl ,而无须指定其所在的名字空间 std ,因为 std 名字空间的所有名称已经在全局域中曝光。
