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);
    }

  • 相关阅读:
    贝叶斯推断祭
    libstdc和glibc的一些共享库问题
    nf_conntrack之解决方案
    Too many open files 问题
    Centos系统 上下文切换的检查思路
    GPS坐标转大地坐标
    【转】关于IAP与APP互相跳转的实现
    stm32定时器计数功能
    C库函数——字符串转数字整理
    【转】sscanf函数用法实例
  • 原文地址:https://www.cnblogs.com/2014acm/p/3903180.html
Copyright © 2011-2022 走看看