Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:第一次实验,不行,不知道为什么,请指教In Reply To:第一次实验,不行,不知道为什么,请指教 Posted by:f_jy at 2005-03-24 20:37:42 #include<string.h> #include<stdio.h> #include<iostream.h> void main(){ int num; char judge[9]; cin>>num; gets(judge); int max=10,min=1; while(1) { if(strcmp(judge,"too high")==0) { if(max>=num)max=num-1; } else if(strcmp(judge,"too low")==0) { if(min<=num)min=num+1; } else if(strcmp(judge,"right on")==0) { if(num>=min&&num<=max)cout<<"Stan may be honest"<<endl; else cout<<"Stan is dishonest"<<endl; min=1; max=10; } cin>>num; if(num==0)break; gets(judge); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator