how to compare a strings without using string compare predefine function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to compare a strings without using string compare predefine function?

10th Nov 2016, 8:44 AM
DEATH WALKER
DEATH WALKER - avatar
3 Answers
+ 16
Dear aditya kumar pandey, it was just a missprint. Don't be so picky.
10th Nov 2016, 10:23 AM
Lara
Lara - avatar
+ 12
you can just compare them without using anything. The program will compare them by alphabetical order include <iostream> #include <string> using namespace std; int main() { string word= "lara"; string some= "alar"; if(word<some) cout<<word; else cout<<some; return 0; }
10th Nov 2016, 9:51 AM
Lara
Lara - avatar
+ 1
Do not fight please.....
10th Nov 2016, 10:33 AM
DEATH WALKER
DEATH WALKER - avatar