Code /* default1.cpp David Klick CIS 250 2005-02-21 Demonstrates default arguments and enumeration. */ #include #include using std::string; enum ALIGN { LEFT, CENTER, RIGHT }; void banner(string msg, ALIGN align=LEFT); int main(void) { string str = "Demonstration of default values"; // demonstration of function overloading banner(str); banner(str, LEFT); banner(str, CENTER); banner(str, RIGHT); return 0; } void banner(string s, ALIGN al) { using std::cout; using std::endl; int n; switch (al) { case LEFT: n = 0; break; case CENTER: n = (80 - s.length()) / 2; break; case RIGHT: n = 80 - s.length(); } while (n-- > 0) cout << ' '; cout << s << endl; return; }