#include <bits/stdc++.h> #include <windows.h> using namespace std; int main(){ int maxx = 10,minn = 0,i = 0; string t; cout<<"请想一个数字"<<endl; if(MessageBox(NULL,"想好了吗?","提示",MB_YESNO)==IDYES){ do{ i++; t = "它是比"+to_string((minn+maxx)/2)+"大吗?"; if(MessageBox(NULL,t.t_str(),"提示",MB_YESNOCANCEL)==IDYES){ minn = (minn+maxx)/2; }else{ maxx = (minn+maxx)/2; } }while(MessageBox(NULL,"想好了吗?","提示",MB_YESNOCANCEL)!=IDCANCEL); cout<<"我太厉害了,只用了"<<i<<"次就猜出来了"<<endl; while(MessageBox(NULL,"我是不是很厉害","提示",MB_YESNO)!=IDYES){ cout<<"点是"<<endl; } }else{ cout<<"请想一个数字"<<endl; } return 0; }
标签:std,窗口,数字,AI,int,include From: https://www.cnblogs.com/wangyihang-xh/p/18172024