Output required

Please explain how to find out the answer

Find the output of the following program:
#include <iostream.h>
void Secret(char Str[ ])
{
for (int L=0;Str[L]!='\0';L++);
for (int C=0;C<L/2;C++)
if (Str[C]=='A' || Str[C]=='E')
Str[C]='#';
else
{
char Temp=Str[C];
Str[C]=Str[L-C-1];
Str[L-C-1]=Temp;
}
}
void main()
{
char Message[ ]="ArabSagar";
Secret(Message);
cout<<Message<<endl;
}
There should be no output, because it shouldn't even compile.
Or, I suppose the output should be something along the lines of
Error: iostream.h: no such file or directory
Then, after you fix that...
In function 'void Secret(char*)':
error: 'L' was not declared in this scope
   for (int C=0;C<L/2;C++)
                  ^
At global scope:
error: '::main' must return 'int'
 void main()
           ^
Last edited on
you should probably do some research ldm. there is an iostream.h, but it is outdated and replaced with iostream. @suma: you should probably update your compiler. void main is now considered bad c++. (in fact i think it always was because the standard said main should return an int)
Little Bobby Tables wrote:
you should probably do some research ldm. there is an iostream.h, but it is outdated and replaced with iostream.
It is not only outdated, but also deprecated, meaning that compilers don't have to (and shouldn't) support it.
sorry i meant deprecated. but i believe his compiler is outdated, which is why it supports it
Topic archived. No new replies allowed.