zoukankan      html  css  js  c++  java
  • 160809225_叶桦汀_C语言程序设计实验2 选择结构程序设计_进阶

    #include<stdio.h>
    #include<math.h>
    int main()
    {
         int a,b,c,l,p,s;
         printf("请输入三个数:");
         scanf("%d%d%d",&a,&b,&c);   
        if(a+b>c && a-b<c)
        {
            l=a+b+c;
            p=(a+b+c)/2;
            s=sqrt(p*(p-a)*(p-b)*(p-c));
            printf("此三条边可以构成三角形:
    ");
            printf("三角形的周长为 :%d
    三角形的面积为:%d",l,s);   
        }
        else
            printf("此三条边不可以构成三角形:");
        return 0;
    }   

    #include<stdio.h>
    int main()
    {
        float a,tax=0,TaxIncome=0;
        printf("请输入您的工资:");
        scanf("%f",&a);
        if(a<=1455)
        {
            tax=(a-3500)*0.03-0;
            TaxIncome=a-tax;
        }
        else if(a>1455 || a<=4155)
        {
            tax=(a-3500)*0.1-105;
            TaxIncome=a-tax;
        }
        else if(a>4155 || a<=7755)
        {
            tax=(a-3500)*0.2-555;
             TaxIncome=a-tax;
        }
        else if(a<7755 || a<=27255)
        {
            tax=(a-3500)*0.25-1005;
            TaxIncome=a-tax;
        }
        else if(a>27255 || a<=41255)
        {
            tax=(a-3500)*0.3-2755;
            TaxIncome=a-tax;
        }
        else if(a>41255 || a<=57505)
        {
            tax=(a-3500)*0.35-5505;
            TaxIncome=a-tax;
        }
        else
        {
            tax=(a-3500)*0.45-13505;
            TaxIncome=a-tax;
        }
        printf("您本月应缴税为:%f
    您本月应的税后收入为:%f
    ",tax,TaxIncome);
        return 0;}

    #include<stdio.h>
    #include<stdlib.h>
    #include<time.h>
    int main()
    {
        int yournumber,mynumber,count=0;   
        char c;
        do
        {
            srand((unsigned)time(NULL));
            mynumber=(rand()%(101-1)+1);
            do
            {
                printf("请输入您所猜的数字:");
                scanf("%d",&yournumber);
                count++;
                if(yournumber>mynumber)
                    printf("对不起您猜大了,请重新输入
    ");
                else if (yournumber<mynumber)
                    printf("对不起您猜小了,请重新输入
    ");
                else if(yournumber==mynumber)
                    printf("恭喜您猜对了!:
    ");
                else
                    printf("您的数字不合法,请重新输入:
    ");
            }while(yournumber!=mynumber);
        printf("您一共猜了:%d次
    ",count);
        if(count<=3)
            printf("Great!您真是一个天才!
    ");
        else if(count>4 && count<=7)
            printf("亲,不用担心,您的智力还是正常的哦!
    ");
        else
            printf("亲,建议您不要从事虚要智商的活动:
    ");
    1
    2
    3
    4
    5
    6
    7
    <em id="__mceDel">    printf("如果您还想继续的话,请你按y|Y,退出请按n|N:");
        getwchar();
        c=getwchar();
        system("cls");
        } while(c=='y'||c=='Y');
        return 0;
    }    </em>

    这次作业十一做就是卡主没法动在回学校老师讲了可之后才完成这之中我的循环能稍微熟练掌控的只有for其他两个无法独立完成在很多单词我都没有记住如果没有自动出来提示就没法动所以记住基本单词是c语重要的一环

  • 相关阅读:
    dd是___元素
    【电商8】footer mod_service
    外边距塌陷问题
    隐藏display: ____;
    判断一个32位的整数的二进制有几个1
    8 switch case
    键盘录入
    两个整数的交换
    运算符
    java 异常报错总结
  • 原文地址:https://www.cnblogs.com/yehuating/p/5954612.html
Copyright © 2011-2022 走看看