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 |
求教:wa了n次,但还是找不到问题所在,请高手帮忙看看~~~~~#include<iostream.h> #include<string.h> #include<stdio.h> int main() { short a[10],i,m; char p[9]; for(i=0;i<10;i++)a[i]=0; while(1) { cin>>m;fflush(stdin); if(m==0)break; gets(p); if(strcmp(p,"too low")==0) {for(i=0;i<m;i++)a[i]=1;} if(strcmp(p,"too high")==0) {for(i=9;i>=m-1;i--)a[i]=1;} if(strcmp(p,"right on")==0) { if(a[m-1]==0)cout<<"Stan may be honest"<<endl; else cout<<"Stan is dishonest"<<endl; for(i=0;i<10;i++)a[i]=0; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator