MasterGun

Multiply test fixed

May 15th, 2021 (edited)
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. using namespace std;
  2. void generate(int *a, int *b, int *c) {
  3.     srand(time(NULL));
  4.     *a = rand() % 10;
  5.     *b = rand() % 10;
  6.     *c = *a * *b;
  7. }
  8. int main() {
  9.     setlocale(LC_ALL, "rus");
  10.     double answer = 0;
  11.     int score = 0;
  12.     int a = 0;
  13.     int b = 0;
  14.     int c = 0;
  15.     for (int i = 0; i < 10; i++) {
  16.         generate(&a, &b, &c);
  17.         cout <<a<<"*"<<b<<"=Ρ‡Π΅ΠΌΡƒ?"<< endl;
  18.         cin >> answer;
  19.         if (answer == c) {
  20.             score++;
  21.         }
  22.         else {
  23.  
  24.         }
  25.         answer = 0;
  26.     }
  27.     if (score == 10 || score == 9) {
  28.         cout << "Noice" << endl;
  29.         cout << score << endl;
  30.     }
  31.     else if (score == 8 || score == 7) {
  32.         cout << "Not bad" << endl;
  33.         cout << score << endl;
  34.     }
  35.     else if (score <= 6) {
  36.         cout << "NOT GOOD ENOUGHT" << endl;
  37.         cout << score << endl;
  38.     }
  39.     return 0;
  40. }
Add Comment
Please, Sign In to add comment