zoukankan      html  css  js  c++  java
  • 第九周作业

    这个作业属于哪个课程 C语言程序设计
    这个作业要求在哪里 https://edu.cnblogs.com/campus/zswxy/software-engineering-class2-2018/homework/3124
    我在这个课程的目标是 掌握结构体
    这个作业在哪个具体方面帮助我实现目标 熟练掌握结构体
    参考文献 中国大学mooc

    6-1 按等级统计学生成绩 (20 分)

    int set_grade( struct student *p, int n )
    {
        int f=0;
        struct student *q=p;
        for(int i=0;i<n;i++)
        {
            if((q+i)->score>=85)
            (q+i)->grade='A';
            else if((q+i)->score<85&&(q+i)->score>=70)
            (q+i)->grade='B';
            else if((q+i)->score<70&&(q+i)->score>=60)
            (q+i)->grade='C';
            else
            {
                (p+i)->grade='D';
                f++;
            }
        }
        return f;
    }
    

    7-1 一帮一 (15 分)

    #include<stdio.h>
    struct xue{
        int num;
        char name[9];
    };
    int main()
    {
        int n,i,j;
        scanf("%d",&n);
        struct xue a[n];
        for(i=0;i<n;i++)
        scanf("%d %s",&a[i].num,a[i].name);
        for(i=0;i<n/2;i++)
        {
            for(j=n-1;j>=0;j--)
            {
                if(a[i].num!=a[j].num&&a[j].num!=10)
                {
                    printf("%s %s
    ",a[i].name,a[j].name);
                    a[j].num=10;
                    break;
                }
            }
        }
    }
    

    7-2 考试座位号 (15 分)

    #include<stdio.h>
    struct xin{
        char num[17];
        int shi;
        int kao;
    };
    int main()
    {
        int n,m,i,cha,j;
        scanf("%d",&n);
        struct xin a[n];
        for(i=0;i<n;i++)
        scanf("%s %d %d",a[i].num,&a[i].shi,&a[i].kao);
        scanf("%d",&m);
        for(i=0;i<m;i++)
        {
            scanf("%d",&cha);
            for(j=0;j<n;j++)
            if(a[j].shi==cha)
            printf("%s %d
    ",a[j].num,a[j].kao);
        }
    }
    
  • 相关阅读:
    寒假作业4
    UVA5870 乱搞 Smooth Visualization
    UVA5874 Social Holidaying 二分匹配
    UVA5876 Writings on the Wall 扩展KMP
    hdu1231 最大连续子序列
    hdu3535 混合背包
    hdu3613 扩展KMP
    hdu4333 扩展KMP
    扩展KMP
    hdu4287 字典树
  • 原文地址:https://www.cnblogs.com/yikejiushidouxing/p/10768747.html
Copyright © 2011-2022 走看看