Professional Documents
Culture Documents
EXPLAINATION: This error occured because main is a function and a function name is
succeeded by parenthesis.
The compiler, here, took "int main" as an attempt to declare a global
variable which was in
actuality the main function.
#include <iostream>
using namespace std;
int main();
{
cout<<"Hello World!";
}
EXPLAINATION: There are some inbuilt functions in C++, like, cout, cin, etc. for
which necessary header
files are used. We can not access these functions without the
inclusion of the required header file.
CORRECTION: #include<iostream>
using namespace std;
int main();
{
cout<<"Hello World!";
}
EXPLAINATION: When a comment is to be added, the starting and ending of the comment
must be well defined with
"/*comment*/".
EXPLAINATION: Since a variable stores a value, its data type should be mentioned
always and can not be void.