Okay so this is my code:
char sentence[100];
cin %26gt;%26gt; sentence;
cout %26lt;%26lt; sentence;
If the user puts any spaces in the sentence, it will only display the words up to the first space. How can I fix this problem?
(And I need the variable to be an array of characters)
C++ output?
If you change:
cin %26gt;%26gt; sentence;
to:
cin.getline( sentence, 100, '\n' );
I think that'll do what you want.
Reply:try 'puts(sentence) '
to output the result
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment