Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

各位武林好汉们,帮忙看看,编译器出来的结果老是死循环,希望武林高手指点一下!

Posted by acmhuxiao at 2010-07-29 15:50:54 on Problem 2328
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator