Computer Science, asked by danceloverkate2214, 10 months ago

design a class to overload the function compare () follows;
1. void compare (int,int)_to compare two integer valaue and print the greater of two integers .
2. void compare (char,char)-to compare the numeric value of two characters and print with higher numeric value.
3.void compare (string,string)-to compare the length of two strings and the print longer of the two .plse do it fast it is argent....​

Answers

Answered by dustuavijit
1

Answer:

#include<cstring>

class check

{

int a, b;

public :

void compare( int x, int y)

{

a=x; b=y;

if(a>b) cout<<a;

else cout<<b;

}

void compare( char x, char y)

{

a=x; b=y;

if(a>b) cout<<a;

else cout<<b;

}

void compare( char x[ ], char y[ ])

{

a=strlen(x) ; b=strlen(y) ;

if(a>b) cout<<a;

else cout<<b;

}

};

Similar questions