Commit b3b9ab90 authored by Michael's avatar Michael

michael.davityan:exercise_06_35v9

parent ac120919
Pipeline #25350348 failed with stage
in 53 seconds
Very good!
Very good!
Very good!
No. Please try again.: No. Please try again.: No. Please try again.: Very good!
......@@ -13,14 +13,17 @@ main()
if (::isatty(STDIN_FILENO)) {
std::srand(std::time(0));
}
if (::isatty(STDIN_FILENO)) {
std::cout << "How much is ";
}
int variableForRandomness;
bool answerStatus = true;
while (true) {
srand(variableForRandomness);
const int number1 = 1 + std::rand() % 10;
const int number2 = 1 + std::rand() % 10;
if (::isatty(STDIN_FILENO)) {
std::cout << "How much is ";
}
int number1;
int number2;
if (answerStatus) {
number1 = 1 + std::rand() % 10;
number2 = 1 + std::rand() % 10;
}
if (::isatty(STDIN_FILENO)) {
std::cout << number1 << " * " << number2 << "?: ";
}
......@@ -29,12 +32,8 @@ main()
if (-1 == answer) {
break;
}
bool answerStatus = (answer == number1 * number2);
answerStatus = (answer == number1 * number2);
check(answerStatus);
if (false == answerStatus) {
continue;
}
variableForRandomness = rand();
}
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment