< previous page
page_1151
next page >
Page 1151
10. Given the following input data (where \n denotes the newline character):
ABCDE\n
what is the output of the following program?
#include <iostream.h>
void Rev();
int main()
{
Rev();
cout < endl;
return 0;
}
//***************************************
void Rev()
{
char ch;
cin.get(ch);
if (ch != '\n')
{
Rev();
cout << ch;
}
}
11. Repeat Exercise 10, replacing the
Rev
function with the following version:
void Rev()
{
char ch;
cin.get(ch);
if (ch != '\n')
{
cout << ch;
Rev();
}
}
12. Given the following input:
15
23
21
19
< previous page
page_1151
next page >