0

why when I write: #include <iostream> using namespace std; int main() { cout <<"Hello world!"; return 0 } int main() { ----It says ERROR

28th Jun 2016, 6:47 AM
L-ka
L-ka - avatar
21 Answers
+ 4
remove the- int main () { and add ; after return 0 i.e return 0;
28th Jun 2016, 11:11 AM
Jay Thakur
Jay Thakur - avatar
+ 3
2 reasons... 1st we can't use two main function in a single program 2nd concept of function overloading...
28th Jun 2016, 12:00 PM
Dev!L
Dev!L - avatar
+ 2
semi colon missing there
28th Jun 2016, 8:19 AM
rajshukla
rajshukla - avatar
+ 2
u need ; (semicolon). return 0;
5th Jul 2016, 7:20 PM
Luda glista
Luda glista - avatar
+ 2
add ; after the return 0 and remove the second main
23rd Aug 2016, 6:31 AM
Lucky Agudah Yaw
Lucky Agudah Yaw - avatar
+ 1
because you wrote two variable with the same name, "int main" and because you forgot to close the 2nd variable with a } and a ; is missing After return 0
28th Jun 2016, 7:37 AM
Hector Piteau
Hector Piteau - avatar
+ 1
i think after return 0 it has semicolon.. and delete second int main()
28th Jun 2016, 7:37 AM
Guzel Yadigarova
Guzel Yadigarova - avatar
+ 1
you forgot a semi Colon after return;and you can not write the second int main function. .
28th Jun 2016, 8:15 AM
Nisarg Uchiha
Nisarg Uchiha - avatar
+ 1
you should erased last two lines
29th Jun 2016, 8:16 PM
Sohaib Ahsan
Sohaib Ahsan - avatar
+ 1
you forgot semicolon after 'return 0' and also made a mistake using 2 'int main' after finishing.
30th Jun 2016, 6:24 AM
Joyx Kish
Joyx Kish - avatar
+ 1
use semicolon after return 0;
30th Jun 2016, 5:03 PM
Tanya Gupta
Tanya Gupta - avatar
+ 1
you have not used semicolon for return statement
1st Jul 2016, 3:35 AM
Kadamati Rituraj
Kadamati Rituraj - avatar
0
must error
3rd Jul 2016, 2:11 AM
tianqiyubao88
0
use ; after 0
4th Jul 2016, 11:51 AM
Rishabh Nigam
Rishabh Nigam - avatar
0
add semi colon after the return 0 and clear all other codes after that
4th Jul 2016, 1:46 PM
amit
amit - avatar
0
obviously it'll say errors,u can't use main function like this .
6th Jul 2016, 2:53 PM
Disha
0
whats with the second int main???
9th Jul 2016, 5:49 AM
Prashant
Prashant - avatar
0
Delete int main which is behind and { then run the program
9th Jul 2016, 4:00 PM
Fatih Parlak
Fatih Parlak - avatar
0
semicolon is missing;
1st Sep 2016, 11:10 AM
himanshu rawat
himanshu rawat - avatar
0
yoyi
11th Jan 2017, 12:50 PM
Abhishek Pandey
Abhishek Pandey - avatar