Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
#include
using namespace std; int main() { char myStr1[] = "ABCD"; char myStr2[] = "ABCE"; int cmp = memcmp(myStr1, myStr2, 4); if(cmp > 0) { cout << myStr1 << " is greater than " << myStr2 << "\n"; } else if(cmp < 0) { cout << myStr2 << " is greater than " << myStr1 << "\n"; } else { cout << myStr1 << " is equal to " << myStr2 << "\n"; } return 0; }
ABCE is greater than ABCD