Please consider the following standard C++ program.
#include <iostream> using namespace std; main(){ cout << "Hello, World!"; return 0; }
What is wrong with this?
- include statement: we are including a header or a piece of source code, why isn’t it called iostream.h?
- using namespace std: if standard, it could be omitted and considered standard because it has not been mentioned.
- main function: why there are no parameters in it
- return statement: do we assume the function has been defined as int….
Ideal version, in my opinion…. but opinions are subjective
#include <iostream.h> int main(int argc, char *argv[], char *env[]){ cout << "Hello, World!"; return 0; }