Why is it wrong output | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Why is it wrong output

I made a code for the code coach solution deja vu but it always show deja vu when it should show unique https://code.sololearn.com/cnLUS36ka4Ut/?ref=app

4th Oct 2020, 5:37 AM
Ved Thaker
Ved Thaker - avatar
3 Réponses
+ 4
why u define so many char Variables variable1,variable2...... variable10. You can define string x; cin>>x; Your code woRkiNg infinite times becoz your conditions is true all time and it will print cout << "Deja Vu";} Your commented last cout statement and use round bracket in conditions .
4th Oct 2020, 6:25 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Of course! Your code always shows "Deja Vu", because if statement is always true. You should use loop which runs up to input number. Read question carefully. Good Luck!
4th Oct 2020, 5:49 AM
Win Htay 🇲🇲
Win Htay 🇲🇲 - avatar
+ 1
Win Htay Amanbek Orynbay ok I used do while but I only want it once how to fix that?
4th Oct 2020, 6:13 AM
Ved Thaker
Ved Thaker - avatar