+ 1
Why the code ia showing error?
#include <iostream> using namespace std; void main() { int a; cout << "Please enter a number \n"; cin >> a; cout << a; }
2 Respuestas
+ 4
You need int main() instead of void main(), and return 0; at the end of main().
+ 4
Yeah, what Rowsej said. Integer return type for main is a must. Returning 0 explicitly is optional though. The compiler adds it in for you if you don't write one in main().
http://www.stroustrup.com/bs_faq2.html#void-main