我的程序(c ++):
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
float x, y, z;
char d[20];
int main()
{
cin.getline >>d;
x=111;
y=222;
z=333;
ofstream meuarquivo;
meuarquivo.open (d".txt");
meuarquivo << x << "\n";
meuarquivo << y << "\n";
meuarquivo << z << "\n";
meuarquivo.close ();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我想写一些类似"ThatsMyProgram"的东西,我希望程序将此文件保存为"ThatsMyProgram.txt".我怎样才能做到这一点?
c++ ×1