Electrical and Computer Engineering
4 of 30
UAH
CPE 112
Notes on Program Execution
•The first statement in main is cout << The square of 27 is” << Square(27) << endl; •During the execution of this statement, Square is called, returning a value of 729, which is printed out, followed by a new line character. •Then, the statement cout << “and the cube of 27 is” << Cube(27) << endl; is executed which includes a call of Cube. The value 19683 (the cube of 27) is displayed. •Both Square and Cube are examples of value-returning functions, i.e. int Square(int n). •main is also a value-returning function, 0 usually indicates normal (error-free) execution has occurred.
•main is called by the operating system.