Commit 5a907851 authored by Michael's avatar Michael

michael.davityan:exercise_04_20

parent 029bfe6c
Pipeline #23082529 passed with stage
in 1 minute and 43 seconds
......@@ -10,29 +10,26 @@ Analysis::processExamResults()
int studentCounter =1;
int result;
while (studentCounter <= 10) {
while (true) {
if (::isatty(STDIN_FILENO)) {
std::cout << "Enter result (1 = pass, 2 = fail): ";
}
bool breakCondition = true;
while (breakCondition) {
std::cin >> result;
if (1 == result) {
++passes;
breakCondition = false;
} else if (2 == result) {
++failures;
breakCondition = false;
} else {
std::cout << "Wrong result, please insert 1 or 2: ";
}
std::cin >> result;
if (1 == result) {
++passes;
++studentCounter;
} else if (2 == result) {
++failures;
++studentCounter;
} else {
std::cout << "Wrong result, please insert 1 or 2: ";
}
++studentCounter;
}
std::cout << "Passed " << passes << "\nFailed " << failures << std::endl;
if (passes > 8) {
std::cout << "Raise tuition" << std::endl;
}
if (11 == studentCounter) {
std::cout << "Passed " << passes << "\nFailed " << failures << std::endl;
if (passes > 8) {
std::cout << "Raise tuition" << std::endl;
}
return;
}
}
}
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