首页 > 其他 > 详细

蓝桥PREV-55

时间:2019-12-04 11:29:01      阅读:77      评论:0      收藏:0      [点我收藏+]

https://blog.csdn.net/DOGOD_Q/article/details/102755646

小计算器杀我

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

long long read(int);
void put(long long,int);
int main()
{
    int n;
    scanf("%d",&n);
    getchar();
    long long num1=0,num2=0;
    bool bo;
    int jz=10;
    int i;
    for(i=0; i<n; i++)
    {
        char s[20];
        puts(s);
        int taps;
        if(s[0]==C&&s[1]==L)
            bo=0;
        else if(s[0]==N)
        {
            if(bo)
            {
                num2 = read(jz);
                if(taps == 1)
                    num1 += num2;
                if(taps == 2)
                    num1 -= num2;
                if(taps == 3)
                    num1 *= num2;
                if(taps == 4)
                    num1 /= num2;
                if(taps == 5)
                    num1 %= num2;
            }
            else
            {
                num1 = read(jz);
                bo = 1;
            }
        }
       else if(s[0] == A)
            taps = 1;
        else if(s[0] == S)
            taps = 2;
       else if(s[0] == M && s[1] == U)
            taps = 3;
       else if(s[0] == D)
            taps = 4;
        else if(s[0] == M && s[1] == O)
            taps = 5;
        else if(s[0] == C && s[1] == H)
            scanf("%d",&jz);
        else if(s[0] == E)
        {
            printf("%s",put(num1, jz));
        }
    }
    return 0;
}

 

蓝桥PREV-55

原文:https://www.cnblogs.com/calm-blogme/p/11980841.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!