Hello.Can you help me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello.Can you help me?

Enter two lines, compare them(which are long) Is there any other way to do this? https://code.sololearn.com/cytIMNAk0g16/?ref=app Input: array ; array massive Output : the second word is longer than the first

29th Dec 2020, 2:02 PM
Plutos
Plutos - avatar
4 Answers
+ 3
Two things to be noted in your code and it works fine . First is taking user input , Use getline(cin,str); instead of depricated old gets () ,if you are not inputting more than 1 word its better to use cin<< , otherwise use getline . Second Know how to compare string length in cpp .
29th Dec 2020, 2:09 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 2
I don't know what the problem is on line 10 and 12. but on the line 18, you need to use brackets since you're printing out more than one line in the if and else statements.
29th Dec 2020, 2:09 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
29th Dec 2020, 2:33 PM
Alphin K Sajan
Alphin K Sajan - avatar
0
Thank you very much
29th Dec 2020, 2:14 PM
Plutos
Plutos - avatar