// Example with functions // These #include statements also declare information at "file scope" #include #include #include // Example of a constant identifier // // Set up the identifier PI to the const value of 3.14159 // Many people will refer to PI as a "constant variable". const double PI = 3.14159; double temp = 3.14159; // default parameter example - C++ allows us to specify default // parameter values. These values are assigned to the formal // parameter if no actual parameter is given. inline double calcCircleArea (double rad) { return PI * pow (rad, 2); } int calcAreaOfBox (int len = 1, int wid = 1, int hgh = 1) { cout << "Length: " << len << ", Width: " << wid << ", Height: " << hgh << endl; return len * wid * hgh; } int main() { int c1, c2, c3, c4; c4 = calcAreaOfBox (10, 20, 4); cout << "The Area is: " << c4 << endl; c4 = calcAreaOfBox (10, 20); cout << "The Area is: " << c4 << endl; c4 = calcAreaOfBox (10); cout << "The Area is: " << c4 << endl; c4 = calcAreaOfBox (); cout << "The Area is: " << c4 << endl; cout << "Ending Main" << endl; }