// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI 1380.01, Summer I, 2008 // Lab 21: function overloading and static local variables // Date: June 15, 2008 // Comment: The code here is meant to be revised. // ***************************************************************** #include #include using namespace std; #ifndef LAB_23_HEAD_H #define LAB_23_HEAD_H //This function has a static local variable void cat( ) { //static local variable declaration and initialization static int x=10; //print x cout<<" I am inside cat and x is " <= y ? x : y; } //this definition is for dealing with integers values char swapAndLarger(char & x, char & y) { char tmp; //swap first tmp=x; x=y; y=tmp; //return the larger return x >= y ? x : y; } //this definition is for dealing with integers values char* swapAndLarger(char x[ ], char y[ ]) { char tmp[50]; //swap first strcpy(tmp, x); strcpy(x, y); strcpy(y, tmp); //return the larger return (strcmp(x, y) >= 0) ? x : y; } //this definition is for dealing with integers values //This is for you: Define this function string swapAndLarger(string & x, string & y) { //Your code is here return "test"; } #endif