While Looping Error

I have tried multiple times to run this code and other similar code I've written, but I keep receiving a massive error and am left unable to run it. Could someone please help out and point out the errors in it.

The objective is to write something that reads in two integers and then prints them out. Simple as that.

1
2
3
4
5
6
7
8
9
10
#include "std_lib_facilities.h"

int main()
{
int x=0;
int y=0;
cin<<x<<y;
while(x<10 && y<10){cout<<"you typed :"<<x<<","<<y;
x++;y++;}
}
> but I keep receiving a massive error
$ g++ foo.cpp 2>&1 | grep error
foo.cpp:7:6: error: no match for ‘operator<<’ in ‘std::cin << x’ (operand types are ‘std::istream {aka std::basic_istream<char>}’ and ‘int’)


It should be cin>>x>>y; assuming that you do have `std_lib_facilities.h' header, otherwise you'll need to #include <iostream> and qualify the std namespace.


PS: you need to learn to indent.
Topic archived. No new replies allowed.