#include <iostream>using namespace std; int main() { // your code goes here\ int x = 10; int &ref = x; ++ref; cout<<x<<"\t"<<ref<<endl; int y = 20; ref = y; ++ref; cout<<y<<"\t"<<ref<<endl; int z = 30; int &ref = z; ++ref; cout<<z<<"\t"<<ref<<endl; cout<<x<<"\t"<<y<<"\t"<<z<<endl; return 0;}
Standard input is empty
prog.cpp: In function 'int main()': prog.cpp:7:13: error: 'x' was not declared in this scope int &ref = x; ^ prog.cpp:21:7: error: redeclaration of 'int& ref' int &ref = z; ^ prog.cpp:7:7: note: 'int& ref' previously declared here int &ref = x; ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!