Solved

Input

Posted on 2000-03-06
4
181 Views
Last Modified: 2010-04-02
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
Comment
Question by:SBuntin
  • 2
  • 2
4 Comments
 

Expert Comment

by:gashev
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

by:nietod
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

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

Accepted Solution

by:
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now