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 |
各位武林好汉们,帮忙看看,编译器出来的结果老是死循环,希望武林高手指点一下!#include<iostream> #include<string> using namespace std; int main() { int i,n,s; int num[11],a[11]; char str[11],str1[11]; while(n!=0) { freopen("d:\\2328.txt","r",stdin); int count=0; for(i=0;i<10;i++) { cin>>num[i]; if(num[i]==0) { n=0;break; } cin>>str1>>str; if(strcmp(str,"high")==0) a[i]=1; if(strcmp(str,"low")==0) a[i]=-1; if(strcmp(str,"on")==0) { s=num[i];break; } count++; } if(n!=0) { for(i=0;i<count;i++) { if((num[i]-s)*a[i]<0) { cout<<"Stan is dishonest"<<endl; count=-1; break; } } if(count!=-1) cout<<"Stan may be honest"<<endl; } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator