Home > Back-end >  Excuse me write c Max function template, and implementation and reload it for a maximum of two c - a
Excuse me write c Max function template, and implementation and reload it for a maximum of two c - a

Time:09-16

Excuse me write Max function template, and implementation and reload it for a maximum of two C - a String (that is, the use of character array to store the String) how to do it

CodePudding user response:

 # include 
using namespace std;

String Max (string a, string b) {
If (a.s considering () & gt; B.s considering ()) {
return a;
} else if (a.s considering () & lt; B.s considering ()) {
return b;
}
for(int i=0; iIf (a [I] & gt; [I]) {b
return a;
[I]} else if (b & gt; A [I]) {
return b;
}
}
}

Int main () {
String a, b;
Cin> A> b;
Cout & lt; return 0;
}
  • Related