• bailian 2694



    #include<stdlib.h> 头文件


    atof 将字符串 转化为 一个双精度值

    int atof(a)

     


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

    double exp()
    { char a[20];
    scanf("%s",a) ;
    switch(a[0])
    {
    case'+': return exp()+exp();
    case'-': return exp()-exp();
    case'*': return exp()*exp();
    case'/': return exp()/exp();
    default: return atof(a);
    }
    }

    void main( )
    { double ans ;
    ans=exp();
    printf("%f ",ans);

    }

    ***********************************************************************************************************

    77<liqino1friend@qq.com> 17:59:04

    *********************************************************
    #include <stdio.h>
    #include <math.h>
    #include <string.h>
    #include <stdlib.h>
    double ans;
    double oper()
    {
    char a[100];
    scanf("%s",a);
    switch(a[0])
    {
    case '*': return oper()*oper();
    case '/': return oper()/oper();
    case '+': return oper()+oper();
    case '-': return oper()-oper();
    default: return atof(a);
    }
    }
    int main()
    { ans=0;
    ans=oper();
    printf("%.6f ",ans);
    }


    ****************************************************************************8
    [--李吉环--]<lijihuan0@qq.com> 17:59:22

    ************************************************
    #include<iostream>
    #include<algorithm>
    #include<cstdio>
    #include<math.h>
    using namespace std;
    double xp()
    {
    char a[20];
    scanf("%s",a);
    switch(a[0])
    {
    case '+':return xp()+xp();
    case '-':return xp()-xp();
    case '*':return xp()*xp();
    case '/':return xp()/xp();
    default:return atof(a);
    }
    }
    int main()
    {
    double ans;
    ans=xp();
    printf("%f",ans);
    }

  • 相关阅读:
    codesmith
    moment.js
    select2
    Lodash js数据操作库
    angular.js
    vue.js
    axios.js
    RoutePrefix和Route 路由前缀
    Tuple元组 C#
    ningx访问日志切割
  • 原文地址:https://www.cnblogs.com/2014acm/p/3903180.html
Copyright © 2020-2023  润新知