compare two strings
May 5, 2012 at 4:46pm
Hi everyone
I need to create function which compares two strings and finds maximum of them.
I have tried this code
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <iostream>
using namespace std;
inline string max(string, string);
int main()
{
string r, j;
cin>>r>>j;
}
inline string max(string a, string b)
{
string max=a;
if(max<b) max=b;
return max;
}
|
but it doesn't work; Is it wrong? if someone can help me I'll be grateful
May 5, 2012 at 4:51pm
What is it that doesn't work? Maybe you have to include <string>.
Topic archived. No new replies allowed.