## Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

• Help others & share knowledge
• Earn cash & points
Solved

# Input

Posted on 2000-03-06
186 Views
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?
0
Question by:SBuntin
• 2
• 2

Expert Comment

ID: 2588917
Example:

#include <iostream.h>

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

LVL 22

Expert Comment

ID: 2588933
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

LVL 22

Expert Comment

ID: 2588940
Opps, gashev beat me to it.  Gashev, you should have answered.  I'll withdraw mine.
0

Accepted Solution

gashev earned 30 total points
ID: 2609870
Example:

#include <iostream.h>

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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.