Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL,"RUS");
- int k;
- cout<<"Загадайте число от 1 до 100: ";
- cin>>k;
- char* str1 = "Слишком мало";
- char* str2 = "Слишком много";
- char* str3 = "В точку";
- char* str4;
- str4 = str1;
- int k1 = 1;
- int k2 = 99;
- while (str4 != str3)
- {
- cout<<"Ваше число - "<<rand()%k2 + k1<<"?"<<endl;
- cin>>str4;
- if (str4 == str1)
- {
- k1 = rand()%k2 + k1;
- }
- if (str4 == str2)
- {
- k2 = rand()%k2 + k1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement