Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
536 B
3
Indexable
#include <iostream>
#include <ctime>

using namespace std;

int main()
{   
    setlocale(LC_ALL, "ru");
    srand(time(nullptr));

    int a = rand() % 10 + 1;
    int count = 0;
    int i = 0;

    while (i != a) {
        cin >> i;
        if (i > a) {
            cout << "меньше" << endl;
        }
        if (i < a) {
            cout << "больше" << endl;
        }
        count += 1;
    }

    cout << "ура угадал" << " " << "за" << " " << count << " " << "попыток";

}