36. (a) Find the output of the following program:
#include<iostream.h>
#include<ctype.h>
typedef char Str80[80];
void main()
{
char *Notes;
Str80 Str = "vR2GooD" ;
int L = 6;
Notes = Str ;
while(L >= 3)
{ Str[L] = (isupper(Str[L]) ?
tolower(Str[L]) : toupper(Str[L]));
cout << Notes << endl;
L--;
Notes++;
}
}
Answers
Answer:
you will get error when you compile that program
Error you get:
main.cpp:4:11: error: ‘::main’ must return ‘int’
main.cpp:13:1: error: ‘cout’ was not declared in this scope
main.cpp:13:1: note: suggested alternative:
In file included from main.cpp:1:0:
/usr/include/c++/6/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
^~~~
main.cpp:13:18: error: ‘endl’ was not declared in this scope
main.cpp:13:18: note: suggested alternative:
In file included from /usr/include/c++/6/iostream:39:0,
from main.cpp:1:
/usr/include/c++/6/ostream:590:5: note: ‘std::endl’
endl(basic_ostream<_CharT, _Traits>& __os)
^~~~
Explanation
You have to compile the program yourself and check that it works and then you have to ask the output