Answer to Question #25040 in C++ for hanrik
Write a C++ program that accepts the complete name of a person (first middle last) then print them separately.
1
2013-02-26T09:59:12-0500
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main()
{
// useless. We need user keyboard input. Not embeded name
// in Standard C++ which is the norm.
string s("John Doe");
istringstream iss(s);
string sub;
iss >> sub;
cout << "First Name: " << sub << endl;
iss >> sub;
cout << "Last Name: " << sub << endl;
return 0;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment