Input

How do you input numbers on the same line?

EX.

Tell how many quarters , pennies, and dimes you have? 1 2 3

How are you able to input them on the same line?
SBuntinAsked:
Who is Participating?
 
gashevConnect With a Mentor Commented:
Example:

#include <iostream.h>

void main(void)
{
 int a,b,c;
 cin>>a>>b>>c;
 cout<<a<<endl<<b<<endl<<c<<endl;
}
0
 
gashevCommented:
Example:

#include <iostream.h>

void main(void)
{
 int a,b,c;
 cin>>a>>b>>c;
 cout<<a<<endl<<b<<endl<<c<<endl;
}
0
 
nietodCommented:
seperate them with spaces (or enters). like

int q, p, d;

cout << "Tell how many quarters , pennies, and dimes you have? 1 2 3 "
cin >> q >> p >> d;

then at the prompt type "1 2 3".  Let me know if you have any questions.
0
 
nietodCommented:
Opps, gashev beat me to it.  Gashev, you should have answered.  I'll withdraw mine.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.