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

恳请好心人,可以帮我看看我的代码错在哪里?为什么WA,花不了很长时间,您就看一眼,可以的话,回复我!谢谢!!

Posted by VID at 2014-09-10 19:37:28 on Problem 2328
#include<iostream>
#include<cstring>
using namespace std;

int main()
{
	int a;
	char ans[10];
	while(1)
	{
		bool flag = false;
		int Max  = 100;
		int Min  = 0;
		cin>>a;
		if(a == 0)
			break;
		getchar();  
		gets(ans);
		
		while(1)
		{
			if(a>Max||a<Min)
				flag = true;
			
			if(strcmp(ans,"right on") == 0)
				break;
			if(strcmp(ans,"too high") == 0&&a<Max)
				Max = a;

			if(strcmp(ans,"too low") == 0&&a>Min)
				Min = a;
			cin>>a;
			getchar();  
			gets(ans);
		}
		
		if(flag)
		{
			cout<<"Stan is dishonest"<<endl;
		}
		else
			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