L
Luis
Please help, this is due at 11:59 PM tonite. Thanks
Write a program that reads a person's name from the keyboard in the format
First Middle Last. It should then (1) print each of the names on a separate
line and (2) print the person's initials on the fourth line. Assume that
each person has exactly 3 names, that the first name begins in the first
position on a line (there are no leading blanks) and that the names are
separated from each other by a single blank.
Do not use arrays in this assignment.
SO far i gigured out only how to print out the initials, but i can't figure
out how to get each part of a name as a seperate string. Can any one help me
out? here is my source so far
#include <iostream>
#include <string>
using namespace std;
int main ()
{
char m;
char l;
char f;
cin>>f;
cin.ignore(100,' ');
cin>>m;
cin.ignore(100,' ');
cin>>l;
cout<<f<<m<<l<<endl;
return 0;
}
Write a program that reads a person's name from the keyboard in the format
First Middle Last. It should then (1) print each of the names on a separate
line and (2) print the person's initials on the fourth line. Assume that
each person has exactly 3 names, that the first name begins in the first
position on a line (there are no leading blanks) and that the names are
separated from each other by a single blank.
Do not use arrays in this assignment.
SO far i gigured out only how to print out the initials, but i can't figure
out how to get each part of a name as a seperate string. Can any one help me
out? here is my source so far
#include <iostream>
#include <string>
using namespace std;
int main ()
{
char m;
char l;
char f;
cin>>f;
cin.ignore(100,' ');
cin>>m;
cin.ignore(100,' ');
cin>>l;
cout<<f<<m<<l<<endl;
return 0;
}