#include <cstdlib>
#include <iostream>
#include <stdlib.h>
using namespace std;
int main(void)
{
int min = 0, max = 2049, said, num = 0;
cout << “Bir Sayi Tutun, Ben Bulayim” << endl;
cout << “NOT: Sorulara Cevap Verirken ‘E’ (EVET) veya ‘H’ (HAYIR) tuslarini kullanin.” << endl;
char ans, ans2, ans3;
cout << “Sayiyi Tuttuunuz mu?”;
cin >> ans3;
while (num != said){
said = (min + max)/2;
cout << “Tuttugunuz Sayi ” << said << “‘ mi?” << endl;
cin >> ans;
switch (ans){
case ‘E || e’ : cout << “Tuttugunuz Sayi; ” << said << endl;
num = said;
break;
case ‘H || h’ : cout << “Tuttugunuz Sayi ” << said << ” ‘ten Buyuk mu?” << endl;
cin >> ans2;
switch (ans2) {
case ‘H || h’ : max = said–;
break;
case ‘E || e’ : min = said++;
break;
}
}
}
system(“PAUSE”);
return EXIT_SUCCESS;
}
Bunu beğen:
Beğen Yükleniyor...