What is the output?Code:int main()
{
recurse(5,3);
return 0;
} // end main
void recurse(int x, int y)
{ if (y > 0)
{ ++x;
--y;
cout << x << " " << y << endl;
recurse(x, y);
cout << x << " " << y << endl;
} // end if
} // end recurse
Printable View
What is the output?Code:int main()
{
recurse(5,3);
return 0;
} // end main
void recurse(int x, int y)
{ if (y > 0)
{ ++x;
--y;
cout << x << " " << y << endl;
recurse(x, y);
cout << x << " " << y << endl;
} // end if
} // end recurse
Did you not run it?
We give up. But if you don't know, and want to, then download and install GCC, the GNU Compiler Collection - GNU Project - Free Software Foundation (FSF) and Code::Blocks, then build, link, and run the program, and you have your answer.
6 2
7 1
7 1
6 2
Again? Is he trying to pass a class w/o running a compiler? Neat trick if you can do it...