Computer Science Canada how to get a string |
Author: | endusto [ Tue May 10, 2005 6:43 pm ] | ||
Post subject: | how to get a string | ||
im just starting and i have a program that will ask you for a number and then tell you the number you entered. how would i make a string so i can enter a word or two instead of just numbers or 1 letter? this is my code:
|
Author: | wtd [ Tue May 10, 2005 6:54 pm ] | ||||
Post subject: | |||||
Declare a string.
Then exatract a string from cin into it.
You now have a "word" (delimited by a space). |
Author: | blackcat [ Wed May 18, 2005 12:46 pm ] | ||
Post subject: | |||
int is for numbers so declare a string liek wtd said so lets use
EDIT[MARTIN]:Grow up. Also, use code tags in the future. |
Author: | jamonathin [ Wed May 18, 2005 1:38 pm ] | ||||||
Post subject: | |||||||
Lets also use
And we need this at the top as well.
<<or so I think>> And you're going to want to put this before your return 0; So that you can read what the program does.
|