64,676
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ofstream a;
string b;
cout << "请输入文件名称:";
cin >> b;
b += ".txt";
a.open(b);
a << "hello!" << endl;
a << 22.35 << endl;
a.close(b);
return 0;
}
#include "stdafx.h"
#include <iostream>
#include <cstring>
#include <fstream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ofstream a;
string b;
cout << "请输入文件名称:";
cin >> b;
b += ".txt";
a.open(b.c_str());
a << "hello!" << endl;
a << 22.35 << endl;
a.close();
return 0;
}