Complete listing of Hello1.cpp
/*File: Hello1.cpp This is a very simple C++ program. It illustrates the basic structure of a C++ program, which has been written in such a way as to prohibit the use of all global variables and global functions except for the main function, which must always be a global function. To compile this program, use an IDE such as MS Visual Studio 6.0. You can then execute the program from within VS 6.0. When you do, the following text will be displayed on the screen: Hello World Press any key to continue A successful compilation and execution from within VS 6.0 will produce ten new files plus one new directory named Debug. You can also execute the compiled program by making Debug the current directory and entering the following command at the command prompt: hello1 ************************************************/ #include <iostream> using namespace std; class Hello1{ public: static void classMain(){ cout << "Hello World" << endl; }//End classMain function };//End Hello1 class //---------------------------------------------// int main(){ Hello1::classMain(); return 0; }//end main Listing 3 |