I need to get a list of numbers from the user, two by two, terminated by ctrl+d. I tried something like what was asked here: the question on while (cin >> )
but it only seems to work with strings, I tried a whole bunch of things, but cant get it to work.
For example, the following code accepts one pair of ints, and then ends:
#include <iostream>
using namespace std;
int main(){
int x,y;
while (cin >> x >> y)
{
cout << "x: " << x << endl;
cout << "y: " << y << endl;
}
}