首页 新闻 会员 周边 捐助

求大虾指导指导

0
悬赏园豆:5 [已关闭问题] 关闭于 2013-02-24 15:54
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
    string content;
    cout << "input your content:" << endl;
    cin >> name;
    ofstream outfile("notebook.txt");
    if (!outfile)
    {
        cout << "File cannot be opened." << endl;
        return 0;
    }
    cout << "what you input is:" << content << endl;
    outfile << content;
    outfile.close();
    string show;
    cout << "do you want to show the file?0/1" << endl;
    int i;
    cin >> i;
    if (i = 0)
        return 0;
    ifstream infile("name.txt");
                  infile >> show;
    cout << "the file is:" << endl;
    cout << show;
    infile.close();

}

本人在学习输入输出流时,想做一个记事本,但是发现如果输入内容中有空格号就会丢失后面的内容,请问大虾如何能把我要记录的内容原原本本地保留下来?是基于输入输出流的知识的哦,感谢

C#
kebin00的主页 kebin00 | 初学一级 | 园豆:196
提问于:2012-12-08 16:57
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册