what is the output for the following version of reverse()

Nov 26, 2011 at 2:20pm
Anyone helps me?

what is the output for the following version of reverse()

void reverve() {
int ch;
cin.get(ch);
if(ch != '\n')
reverve();
cout.put(ch);
}

thank u!
Nov 26, 2011 at 2:29pm
it reads a line form std::cin and outputs it in reverse order
Nov 26, 2011 at 4:19pm
So what will appear on screen?
Nov 26, 2011 at 4:25pm
have you tried running the program?
Nov 27, 2011 at 3:21am
Yes, I've tried. But it announced errors in line "cin.get(ch)". Can u run it and send me ur code?
Nov 27, 2011 at 3:27am
ok, the problem is that ch should be a char instead of an int
Nov 27, 2011 at 3:33am
Wow, it ran when I changed int to char. :x. Thanks for ur help. I expect to see u later. :D
Topic archived. No new replies allowed.