zoukankan      html  css  js  c++  java
  • C语言第五次作业

    1.

    #include<stdio.h>
    int main()
    {
        int a,b,c;
        printf("请输入3个整数:");
        scanf("%d %d %d",&a,&b,&c);
        if(a<b && a<c && b<c)
            printf("%d %d %d",a,b,c);
        if(b<a && b<c && a<c)
            printf("%d %d %d",b,a,c);
         if(b<a && b<c && a>c)
            printf("%d %d %d",b,c,a);
        if(c<a && c<b && a>b)
            printf("%d %d %d",c,b,a);
        if(c<a && c<b && a<b)
            printf("%d %d %d",c,a,b);
        if(a<b && a<c && b>c)
            printf("%d %d %d",a,c,b);
           return 0;
    } 

    2.

    #include<stdio.h>
    int main()
    {
        int a,b;
        printf("请输入车速和限速:"); 
        scanf("%d %d",&a,&b);
        double c=(double)(a-b)*100/b;
        if(c<=10)
            printf("未超速");
        else if(c<50 && c>10)
            printf("超速,罚款200元",c);
        else
            printf("严重超速,吊销驾驶证",c);
        return 0;
    } 

    3.

    #include <stdio.h> 
    int main()
    {     
        double a,b,c,d; 
        int t,n;
        printf("请输入行驶里程与等待时间:");
        scanf("%lf%d",&a,&t); 
        if (a<=3)  
            c=10; 
        else if(a>3 && a<=10)  
            c=10+2*(a-3); 
        else if(a>10) 
            c=24+3*(a-10); 
        if (t<5)  
        { 
            d=0; 
        } 
        else if(t>=5) 
        { 
            n=t/5; 
            d=n*2; 
        } 
        b=c+d; 
        printf("乘客应支付车费为:%.lf
    ",b);
        return 0;
    }

    4.

    #include <stdio.h>
    int main()
    {
        int i,A,B,C,D,E,n,s;
        A=B=C=D=E=0;
        printf("Enter n:");
        scanf("%d",&n);
        for(i=0;i<n;++i)
        {
            printf("Enter grade %d:",i+1);
            scanf("%d",&s);
            switch(s/10)
            {
             case 1:E;break;
            case 2:D;break;
            case 3:C;break;
            case 4:B;break;
            case 5:A;break;
            }
        }
        printf("The number of A(90~100):%d
    ",A);
        printf("The number of B(80~89):%d
    ",B);
        printf("The number of C(70~79):%d
    ",C);
        printf("The number of D(60~69):%d
    ",D);
        printf("The number of E(0~59):%d
    ",E);
        return 0;
    }

    5.看着题就犯懵,求老师教导

    6.

    #include<stdio.h>
    int main()
    {
        int i,j;
        for(j=1;j<=10;j++)
        {
            for(i=1;i<=11-j;i++)
            {
                printf("*");
            }
            printf("
    ");
        }
    } 
  • 相关阅读:
    数据库中Schema(模式)概念的理解
    git错误处理
    mysql存储过程
    bunyan
    golang 小问题
    操作系统
    数据库优化
    内存控制
    MySQL优化2
    mysql优化1
  • 原文地址:https://www.cnblogs.com/nbcjd1n/p/5958492.html
Copyright © 2011-2022 走看看