#include <bits/stdc++.h> using namespace std; int main() { string a; cout<<"请想一个数(1~100)"<<endl; system("pause"); int max = 100,min = 0; while(a!="对了"){ cout<<"我猜那个数是:"<<(max-min)/2+min<<endl; cin>>a; if(a=="大了"){ max = (max-min)/2+min; }else if(a=="小了"){ min = (max-min)/2+min; } } return 0; }
标签:std,return,min,人工智能,max,main From: https://www.cnblogs.com/wangyihang-xh/p/17464196.html