#include%26lt;iostream%26gt;
using namespace std;
int main()
{
char firstinitial, middleinitial, lastinitial;
cout%26lt;%26lt;"please enter your first name:"%26lt;%26lt;endl;
cin.get(firstinitial);
cin.ignore(100, ' ');
cout%26lt;%26lt;"Please enter your middle name:"%26lt;%26lt;endl;
cin.get(middleinitial);
cin.ignore(100, ' ');
cout%26lt;%26lt;"please enter your last name:"%26lt;%26lt;endl;
cin.get(lastinitial);
cin.ignore(100, ' ');
cout%26lt;%26lt;"the initial of all three names are: ";
cout%26lt;%26lt;firstinitial%26lt;%26lt;middleinitial%26lt;%26lt;las...
return 0;
}
C++.im supposed to display the initials of the names. but it doesnt work.what hav i done wrong..pls help!?
Why are you using cin.ignore() ?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment