Commit c5ef7019 authored by Michael's avatar Michael

just commit

parent 48e30dee
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <unistd.h>
void check(bool answerStatus);
void printMessage(bool answerStatus);
void printPassMessage();
void printNotPassMessage();
......@@ -18,26 +19,26 @@ main()
if (::isatty(STDIN_FILENO)) {
std::cout << "How much is ";
}
// if (answerStatus) {
number1 = 1 + std::rand() % 10;
number2 = 1 + std::rand() % 10;
// }
if (answerStatus) {
int number1 = 1 + std::rand() % 10;
int number2 = 1 + std::rand() % 10;
}
if (::isatty(STDIN_FILENO)) {
std::cout << number1 << " * " << number2 << "?: ";
std::cout << Number1 << " * " << Number2 << "?: ";
}
int answer;
std::cin >> answer;
if (-1 == answer) {
break;
}
answerStatus = (answer == number1 * number2);
check(answerStatus);
answerStatus = (answer == Number1 * Number2);
printMessage(answerStatus);
}
return 0;
}
void
check(bool answerStatus)
printMessage(bool answerStatus)
{
if (answerStatus) {
printPassMessage();
......
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