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.
LANGUAGE: C++
CHALLENGE:
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.
SOLUTION:
string name; int age; cin >> name >> age; outdata.open(""outdata""); outdata << name << " " << age; outdata.close();