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 jimmyzzxhlh at 2005-04-03 11:49:47 on Problem 2328
#include<iostream.h>
int main()
{
  int l,h,n,ok;
  char s[100];
  cin>>n;
  while (n != 0)
  {
    l = 1; h = 10; cin>>s; cin>>s; ok = 1;
    while (n != 0 & s[0] != 'o')
    {
      if (s[0] == 'h' & n < h) h = n - 1;
      if (s[0] == 'l' & n > l) l = n + 1;
      if (h < l) ok = 0;
      cin>>n;
      if (n != 0)
      {cin>>s; cin>>s;}
    }
    if (n < l || n > h) ok = 0;
    if (ok == 1) cout<<"Stan may be honest"<<endl;
    else cout<<"Stan is dishonest"<<endl;
    if (n != 0) cin>>n;
  }
  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