Untitled
unknown
plain_text
10 months ago
535 B
1
Indexable
Never
#include <iostream> #include <stdlib.h> using namespace std; int main() { //вроде работает setlocale(LC_ALL, "Russian"); srand(time(NULL)); int a = rand(); int a1; int attemps = 0; do { cin >> a1; if (a1 == a) { cout << "Вы угадали" << endl; break; } else if (a1 > a) { attemps += 1; cout << "Больше" << endl; } else if (a1 < a) { attemps += 1; cout << "Меньше" << endl; } } while (a1 != a); cout << "Количество попыток = " << attemps; }