Please let me know why it's only taking first line to print I want all sentencs to print based on typing speed, please | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Please let me know why it's only taking first line to print I want all sentencs to print based on typing speed, please

https://code.sololearn.com/clx2ZnY4GK5d/?ref=app

1st Nov 2022, 9:10 AM
Omprakash
Omprakash - avatar
12 Respostas
+ 5
Read the error message, look at the line that the error message shows. else does not take any condition. Also check your other conditions, for example: if(wpm>=1 && wpm>10) If wpm is > 10, it will always be >= 1. What you probably mean is if(wpm>=1 && wpm<10)
1st Nov 2022, 9:23 AM
Lisa
Lisa - avatar
+ 4
Again: "else" does not take any condition. if (wpm >= 1 && wmp < 10) ... else if (wmp >= 10 && wmp < 20) ... ... else this is the rest Have a close look at the difference between || and && and the >= and < operators.
1st Nov 2022, 4:35 PM
Lisa
Lisa - avatar
+ 3
Great, it works now :)
1st Nov 2022, 5:37 PM
Lisa
Lisa - avatar
+ 2
Looks good! Just one more thing: Consider your input is exactly 20 ā€“ in that case there is no output. Similar issue for other numbers.
1st Nov 2022, 4:55 PM
Lisa
Lisa - avatar
+ 2
Enter 20. What output do you get?
1st Nov 2022, 5:12 PM
Lisa
Lisa - avatar
+ 1
Because you use if ... else if that execute only the first block where the condition match. At example if wpm is more than 100 all the conditions are matched but only the first is executed (because of else if statements). You can solve by uaing only if without else
1st Nov 2022, 9:24 AM
KrOW
KrOW - avatar
0
Lisa, if I enter 12 it should print 2nd line and if I enter 100 then should last line so?
1st Nov 2022, 4:25 PM
Omprakash
Omprakash - avatar
0
Ok
1st Nov 2022, 4:35 PM
Omprakash
Omprakash - avatar
0
Thanks a lot šŸŒ¹šŸ™ā¤ LISA now it's working
1st Nov 2022, 4:49 PM
Omprakash
Omprakash - avatar
0
I checked for all it's printing desired sentences whatever I want thank you ā¤
1st Nov 2022, 5:01 PM
Omprakash
Omprakash - avatar
0
cout<<"Equivalent to one word every 3 seconds Focus on your technique andkeep practicing.
1st Nov 2022, 5:33 PM
Omprakash
Omprakash - avatar
0
Ok
2nd Nov 2022, 3:50 PM
ASIM FARHEEN ā„ļøāš”āš”šŸ¤³āš”āš”ā„ļø
ASIM FARHEEN ā„ļøāš”āš”šŸ¤³āš”āš”ā„ļø - avatar