【发布时间】:2014-08-08 02:03:14
【问题描述】:
我也需要用户输入他想要写入数据的文件。 示例:你想写什么文本文件“Hello Too”? 他键入:example,数据将进入example.txt文件,其中包含Hello Too。问题是它不能接受一个字符串(accname)并结合 .txt 以使其也将数据发送到该文本文件。很难解释,希望你能理解:D
int Transfersum;
string accname;
cout << "Type the account name you want to send too" << endl;
cin >> accname;
ofstream mfile;
mfile.open ( accname ".txt");
mfile << Transfersum;
mfile.close();
【问题讨论】:
-
字符串连接出现在任何好书的前几章中。
-
mfile.open (accname + ".txt");连接字符串