multiple inputs

Hey,

I'm pretty good with Java but I'm taking a c++ course to learn it and I am hating it. anyways this is my question:

I am trying to have the user input 2 integers (positive or negative) on the same line seperated by a space.

The program should look like this:

Enter the first rational number as numerator (space) denominator: -12 5

how do I go about this? can someone point me in the right direction?
can someone point me in the right direction?


http://www.cplusplus.com/doc/tutorial/basic_io/
The user can always enter variables on the same line or on different lines with cin.

1
2
3
4
5
   int x, y;
   cout << "Enter in 2 numbers" << endl;

   cin >> x;
   cin >> y;


The user can either separate the values by a space or by a carriage return and it will put them into x and y correctly. (You could combine those cin statements into 1 if you wanted to as well).
Topic archived. No new replies allowed.