zoukankan      html  css  js  c++  java
  • 【C Primer Plus】编程练习第三章

    2、

    #include <stdio.h>
    
    int main()
    {
        char ch;
        printf("请输入一个数字:");
        scanf("%d", &ch);
    
        getchar(); // 删除输入缓冲区中的回车键,否则会闪退
        printf("它的字符为%c
    ",ch);
        getchar();
        return 0;
    }

    3、

    #include <stdio.h>
    
    int main()
    {
        printf("a");    //不会被打印出来
        printf("Startled by the sudden sound, Sally shouted,
    ");
        printf(""By the Great Pumpkin, what was that !"");
        getchar();
    }

    4、

    #include <stdio.h>
    
    int main()
    {
        float a;
        printf("Enter a floating-point value:");
        scanf("%f", &a);
        getchar();
        printf("fixed-point notation:%f
    ", a);
        printf("exponential notation:%e
    ", a);
        printf("p notation:%a", a);
        getchar();
        return 0;
    }

     5、

    #include <stdio.h>
    
    int main()
    {
        int a,m;
        printf("一年大概有不知道多少秒,请输入你的年龄:");
        scanf("%d", &a);
        getchar();
        m = a * 365 * 24 * 60 * 60;
        printf("你已经活了%d这么多秒",m);
        getchar();
        return 0;
    }

    6、

    #include <stdio.h>
    
    int main()
    {
        float a,m;
        printf("请输入水的夸脱数:");
        scanf("%f", &a);
        getchar();
        m = a*950/(3.0*10e-23);
        printf("这里的水分子有%f这么多个",m);
        getchar();
        return 0;
    }

     7、

    #include <stdio.h>
    
    int main()
    {
        float a,m;
        printf("请输入你有多少英尺:");
        scanf("%f", &a);
        getchar();
        m = a*2.54;
        printf("那么你有%f厘米这么高",m);
        getchar();
        return 0;
    }

     8、

    #include <stdio.h>
    
    int main()
    {
        float p;
        float b;
        int a,t,c;
        printf("请输入你你能喝多少杯酒:");
        scanf("%f", &b);
        getchar();
        p = b/2;
        a = 8 * b;
        t = 2 * a;
        c = 3 * t;
        printf("那么你能喝%f品脱
    ",p);
        printf("那么你能喝%d盎司
    ", a);
        printf("那么你能喝%d汤勺
    ", t);
        printf("那么你能喝%d茶勺", c);
        getchar();
        return 0;
    }

  • 相关阅读:
    Redis下载和安装
    Redis的Docker镜像
    Hadoop docs
    Hadoop On Demand
    Hadoop Archives
    web.xml中 error-page的正确用法
    zepto.js + iscroll.js上拉加载 下拉加载的 移动端 新闻列表页面
    SVN上传文件注意事项-------------------养成良好的项目文件上传习惯
    在MyEclipse中搭建Spring MVC开发环境
    史上最全最强SpringMVC详细示例实战教程
  • 原文地址:https://www.cnblogs.com/roscangjie/p/11790423.html
Copyright © 2011-2022 走看看