Listing 12, Structures01.cpp
/*File: Structures01.cpp This C++ program illustrates the sequence structure The program displays the following output on the screen: Hello Viet Nam Hello Iraq Hello America Hello World ************************************************/ #include <iostream> using namespace std; class Structures01{ public: static void classMain(){ Structures01* ptrToObject = new Structures01(); ptrToObject -> doSomething(); }//End classMain function //-------------------------------------------// //An instance function of the Structures01 // class void doSomething(){ //This function executes a sequence of // statements and then terminates. The // statements in the sequence do not // include decisions or loops. cout << "Hello Viet Nam\n"; cout << "Hello Iraq\n"; cout << "Hello America\n"; cout << "Hello World\n"; }//end doSomething function };//End Structures01 class //---------------------------------------------// int main(){ Structures01::classMain(); return 0; }//end main Listing 12 |