• 输入五个学生的成绩,得到成绩表


    int[,] a = new int[5, 6];

    for (int i = 0; i < 5;i++ )
    {
    a[i, 0] = i + 1;
    Console.Write("请输入{0}号学生的语文成绩",i+1);
    int yw = Convert.ToInt32(Console.ReadLine());
    a[i, 1] = yw;
    Console.Write("请输入{0}号学生的数学成绩",i+1);
    int sx = Convert.ToInt32(Console.ReadLine());
    a[i, 2] = sx;
    Console.Write("请输入{0}号学生的英语成绩",i+1);
    int yy = Convert.ToInt32(Console.ReadLine());
    a[i, 3] = yy;
    a[i, 4] = (yw + sx + yy) / 3;

    Console.Clear();
    int sum = yw + sx +yy;
    a[i, 5] = sum;

    }


    for (int i = 1; i <= 5; i++)
    {
    for (int j = 1; j <= 5 - i; j++)
    {
    if (a[j, 5] > a[j - 1, 5])
    {
    int txh = a[j - 1, 0];
    a[j - 1, 0] = a[j, 0];
    a[j, 0] = txh;

    int tyw = a[j - 1, 1];
    a[j - 1, 1] = a[j, 1];
    a[j, 1] = tyw;

    int tsx = a[j - 1, 2];
    a[j - 1, 2] = a[j, 2];
    a[j, 2] = tsx;

    int tzf = a[j - 1, 3];
    a[j - 1, 3] = a[j, 3];
    a[j, 3] = tzf;

    int tdd = a[j - 1, 4];
    a[j - 1, 4] = a[j, 4];
    a[j, 4] = tdd;

    int tee = a[j - 1, 5];
    a[j - 1, 5] = a[j, 5];
    a[j, 5] = tee;
    }
    }
    }

    Console.WriteLine("学号 语文 数学 英语 总分");

    for (int i = 0; i < 5; i++)
    {
    for (int j = 0; j < 6; j++)
    {

    if (a[i, j] < 60)
    {
    Console.ForegroundColor = ConsoleColor.Red;
    Console.Write(a[i, j] + " ");

    }

    else
    {

    Console.ForegroundColor = ConsoleColor.White;
    Console.Write(a[i, j] + " ");
    }



    }
    Console.Write(" ");


    }

  • 相关阅读:
    教你修改Linux下高并发socket最大连接数所受的各种限制
    nginx浏览pdf
    Spring3 M2 quartz-2.1.7 解决bean不能注入问题
    DCSync
    Linux下python2.7安装pip
    ._cache_问题
    php-mvc概念
    php第十天-面向对象命名空间
    php第九天-session/cookice会话控制
    fastadmin V1.0.0.20200506_beta 漏洞复现
  • 原文地址:https://www.cnblogs.com/zzc134680/p/5424164.html
Copyright © 2020-2023  润新知