|
-
February 27th, 2002, 07:11 PM
#1
newbe/cs student needs help
hey, im writing a prog in C++ for DOS console. i want to know how to make the program ask for keyboard input, return it, then save it to a string for later use. teacher never went over it and cant find examples.
thank you very much
xerocontrol [gzc]
-
February 27th, 2002, 07:30 PM
#2
Re: newbe/cs student needs help
to ask for a string on the console, use
std:string sin;
std::cin >> sin;
or
std::getline( std::cin, sin );
either way will get you a string. The difference is, the first one will only give you the word up to the first whitespace character while the second will give you a whole line.
Both will be stored in the variable sin
The best things come to those who rate
-
February 28th, 2002, 07:29 PM
#3
Re: newbe/cs student needs help
What, you're doing his homework for him? :P
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|