zoukankan      html  css  js  c++  java
  • hdu 1237

    #include<stdio.h>
    #include<string.h>
    int main() {
     double a;
     double b;
     int c;
     char ch;
     double num[300];
     while(scanf("%d",&c)) {
          if(getchar()==' '&&c==0)//注意必须这样写
        break;
      int i=0;
      num[0]=c;
      while(1) {
       scanf("%c%lf",&ch,&b);
       if(ch=='/')
        num[i]/=b;
       else
        if(ch=='*')
         num[i]*=b;
        else
         if(ch=='+')
          num[++i]=b;
         else
          num[++i]=-b;
         if(getchar()==' ')
          break;
      } 
      a=0;
      for(int j=0;j<=i;j++)
       a+=num[j];
      printf("%.2f ",a);
     }
     return 0;
    }


     

  • 相关阅读:
    记账本开发第一天-补
    20200418-补
    20200411-补
    20200404-补
    20200328-补
    暴力解N皇后
    nN皇后递归
    Hanoi汉诺塔非递归栈解
    Hanoi汉诺塔递归
    JMMjmm模型
  • 原文地址:https://www.cnblogs.com/thefirstfeeling/p/4411009.html
Copyright © 2011-2022 走看看