I am in doubt about an if statement in my code. Help. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

I am in doubt about an if statement in my code. Help.

Hello, I need help with my code. It's a simple thing, but I have a doubt in the if, else and the while loop statements, because it omits a sentence. https://code.sololearn.com/c7KMux0IcQ2k This is my code, the only fault is that the output does not appear on the screen: cout<<"\n If you want to repeat the operation, enter 0, if you want to exit, enter 1"<<endl; cin>>cent;, which is at the end of the "do while", I don't know if it's because of the location or what, but it doesn't print it, and I can't put it before because I don't want it to be part of the loop. I hope you can help me, thanks, good night.

18th Jun 2020, 3:00 AM
Nelli Yunuen
Nelli Yunuen - avatar
5 ответов
+ 1
Again...🙄 Look at line 31: while (divi>=0) Correct to: while (divi>0) And read the reason of the error in my previous post
18th Jun 2020, 4:55 AM
Bilbo Baggins
Bilbo Baggins - avatar
+ 5
Nelli Yunuen your program is working correctly and it give proper output which u want . Its a playground problem try in other compilr. { cout statement << "\n If you want to repeat the operation, enter 0, if you want to exit, enter 1" << endl; cin >> cent; I do not understand why it does not appear on the screen. } its showing properly
19th Jun 2020, 4:05 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
while(div>=0) is not correct if you let div going to 0 you will have a division by 0 https://code.sololearn.com/ceG0HS73cv28/?ref=app All the input in SoloLearn must be on the same line, for example 6 0 2 1
18th Jun 2020, 3:40 AM
Bilbo Baggins
Bilbo Baggins - avatar
+ 1
Sorry, I had not read well. Thank you.
18th Jun 2020, 5:02 AM
Nelli Yunuen
Nelli Yunuen - avatar
0
I have already modified the variable, but the real problem is in the cout statement << "\n If you want to repeat the operation, enter 0, if you want to exit, enter 1" << endl; cin >> cent; I do not understand why it does not appear on the screen.
18th Jun 2020, 4:26 AM
Nelli Yunuen
Nelli Yunuen - avatar