I always see something like this::
Code:
// wrong, but it works!
#include <iostream>
int main()
{
std::cout<<"Hello, World!\n";
return 0;
}
Just for the record C++ is an Object Oriented Programming Language
So why teach in a non-object oriented manner?
Code:
//this is more acceptable
#include <iostream>
class cProgram{
public:
cProgram(){ std::cout << "Hello, World!\n"; }
~cProgram(){ std::cout << "Good bye, World!\n"; }
}
cProgram myApp;
int main()
{
return 0;
}
Its not much more complex than the first example.
And well worth learning.
Lets see some fance hello_world.cpp code.