By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

multiple tokens input to cin

P: n/a
Hi,

How can I use "cin" to take multiple arguements from user input?
The program will display a ">" shell-like command prompt and waiting for
user input one or more arguments in a commandline. So this is different
from a program take multiple arguments when initially start up the program.

Thanks
Sam
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
sam++ wrote:
How can I use "cin" to take multiple arguements from user input?
use 'getline' and parse it.
[..]

Jul 23 '05 #2

P: n/a
Val

"sam++" <sam++@--.com> wrote in message news:d3***********@news.hgc.com.hk...
| Hi,
|
| How can I use "cin" to take multiple arguements from user input?
| The program will display a ">" shell-like command prompt and waiting for
| user input one or more arguments in a commandline. So this is different
| from a program take multiple arguments when initially start up the program.
|
| Thanks
| Sam

string sInput;
while(std::cin>>sInput)
{
// sInput received token. Process it.
}
//No more input.
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.