How can I configure this to read only the first word that the user enters if they enter a lot of information?
I do not want to use the if-else statement, which requires entering new information, because there was a lot of their information.
I just want it to basically ignore everything after the first word and print only the first word entered. Is it possible?
const int SIZEB = 10;
char word[SIZEB];
cout << " Provide a word, up to 10 characters, no spaces. > " << endl;
cin.getline(word, SIZEB);
cout << " The word is: " << word << endl;
cout << endl;
UPDATE
It must be cstring. This is what I work at school. I ask a series of questions and save the answers as cstring in the first round. Then there is a second round where I store them as a string.
source
share