Untitled
unknown
c_cpp
2 years ago
536 B
8
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 << " " << "попыток";
}Editor is loading...