zoukankan      html  css  js  c++  java
  • 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);
    }

  • 相关阅读:
    多线程-上
    IO流之序列化
    IO流之标准输入输出流
    IO流之BufferedReader/BufferedWriter
    IO流之转换流
    IO流之字符输入输出流
    IO流之字节输入输出流
    JS Flex布局
    MSSQL case when
    钉钉审批流API
  • 原文地址:https://www.cnblogs.com/2014acm/p/3903180.html
Copyright © 2011-2022 走看看