how to improve my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to improve my code?

I made code in C++. Offer your options to improve the code. https://code.sololearn.com/c46DyqgE8emo/?ref=app

23rd Nov 2019, 7:05 PM
Port_Play
Port_Play - avatar
1 Answer
+ 1
You could change the while loop to a for loop for(;dices>0;dices--){ //Code } And delete dices -= 1; since decrementation is done in the for loop. You could also declare all ints on one line like int dices = 0, num = 0, now = 0;
23rd Nov 2019, 8:37 PM
Odyel
Odyel - avatar