其他分享
首页 > 其他分享> > poj 2328(找规律,n在toolow的最大数和toohigh的最小数之间)

poj 2328(找规律,n在toolow的最大数和toohigh的最小数之间)

作者:互联网

#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
    char a[][10] = {"too low","right on","too high"};
    int i,low[12],high[12],n,low_num,high_num;
    char t[12];
    bool flag;
    int e = 0,f = 11;
    while(true){
        scanf("%d",&n);
        if(n==0)break;
        gets(t);
        if(!strcmp(t,a[0])){
            e = max(n,e);
        }
        if(!strcmp(t,a[2])){
            f = min(n,f);
        }
        if(!strcmp(t,a[1])){
            if(e<n&&f>n){
                printf("Stan may be honest\n"); 
            }
            else{
                printf("Stan is dishonest\n");
            }
            e = 0;
            f = 11; 
        }
    }
    return 0;
}

 

标签:12,最大数,int,toohigh,2328,high,low,include,strcmp
来源: https://www.cnblogs.com/stevenzrx/p/15573847.html