Read first a user's given name followed by the user's age from standard input. Then use an ofstream object named outdata to write this information separated by a space into a file called outdata. Assume that this is the extent of the output that this program will do.
.
.
Click on the title for the solution
.
.
string name;
int age;
cin >> name >> age;
outdata.open("outdata");
outdata << name << " " << age;
outdata.close();
.
Click on the title for the solution
.
.
This is the answer:
:
string name;
int age;
cin >> name >> age;
outdata.open("outdata");
outdata << name << " " << age;
outdata.close();
Comments
Post a Comment