Need to write a game "Guess the number." Enter the number and number of attempts. Entered a number (it does not display it), and the one who guesses gets the number of attempts. And there in the course writes how many attempts left.
Tell me how to do it, give a starting point, the code is not needed - just a thought.
Did something like this:
#include <iostream.h> void main() { int a, b, p; std::cout << "Vvedite chislo" << std::endl; std::cin >> a; std::cout << "Vvedite kolichestvo popitok" << std::endl; std::cin>>p; int s = 0, e = 1; for(int i = 0; i < p; i++) { std::cin>>b; if(b > a) std::cout << "Bolshe" << std::endl; //Подсказка 1 else if(b < a) cout<<"Menshee"<<endl; // Подсказка 2 else if(b == a) { std::cout << "Vi ugadali chislo" << std::endl; break; // Завершает цикл } s += e; } std::cout << "Popitka nomer - " << s << std::endl; }