0

Проблема с кодом на языке C++

Цикл for выполняется рандомное количество раз https://sololearn.com/compiler-playground/c4Gpz20F2ACA/?ref=app

3rd Jun 2024, 12:24 PM
Davit Tsaturyan
Davit Tsaturyan - avatar
4 ответов
+ 2
The loop does repeat 10 times, but it might not print 10 times because case 2 only prints when random_number_1 > random_number_2. Check the positioning of the if statement. Possibly it should be moved down a few lines?
3rd Jun 2024, 3:38 PM
Brian
Brian - avatar
+ 1
The code runs well. What is the problem that you see?
3rd Jun 2024, 1:59 PM
Brian
Brian - avatar
+ 1
I solved the problem, the problem is that " int random_operation = int random_number_1 = rand() % rand() % 4 +1; 100+ 1; int random_number_2 = rand() % 100 + 1; were written inside a for loop.
3rd Jun 2024, 6:56 PM
Davit Tsaturyan
Davit Tsaturyan - avatar
0
the cycle repeats a random number of times, but I want it to repeat 10 times
3rd Jun 2024, 2:31 PM
Davit Tsaturyan
Davit Tsaturyan - avatar