• 4.23 求大神讲解哪错了。


       static void Main(string[] args)
            {
          int [,] a  = new int  [6,5];
    
          for (int i = 0; i < 6; i ++ )
          {
              Console.WriteLine("请输入第{0}个同学的数学成绩",i +1);
              int  sx =  Convert .ToInt32(   Console.ReadLine());
              Console.WriteLine("请输入第{0}个同学的语文成绩", i + 1);
              int  yw =   Convert .ToInt32 ( Console.ReadLine());
              Console.WriteLine("请输入第{0}个同学的英语成绩",i +1);
              int  yy =     Convert .ToInt32 (    Console.ReadLine());
             a[i, 0]=i +1;
                 a[i, 1]=sx ;
              a[i, 2]=yw ;
              a[i, 3]=yy ;
              a[i, 4] = sx + yw + yy;
          }
          for (int i = 1; i <= 5; i ++ )
          {
              for (int j = 1; j <= 6 - i; j ++ )
              {
                  if (a[j ,4]>a [j -1 ,4])
    
                  {
                      int xyw = a[j, 1];
                      a[j, 1] = a[j - 1, 1];
                      xyw=a [j-1, 1] ;
    
                        int xsx = a[j, 2];
                      a[j, 2] = a[j - 1, 2];
                      xsx=a [j-1 ,2] ;
    
                        int xyy = a[j, 3];
                      a[j, 3] = a[j - 1, 3];
                      a [j-1, 3]=xyy ;
    
                      int xzf = a[j, 4];
                      a[j, 4] = a[j - 1, 4];
                      a[j - 1, 4] = xzf;
    
                     
    
                  }
              }
          }
          Console.WriteLine("学号	语文	数学	英语	总分	名次");
          for (int i = 0; i < 6; i ++ )
          {
              Console.WriteLine("{0}	{1}	{2}	{3}	{4}	{5}",a [i ,0],a [i ,1],a [i ,2],a [i ,3],a [i ,4],i +1);
          }
          
           
                       }
                    }
                }
    

      

  • 相关阅读:
    Centos6.8部署jumpserver(完整版)
    Linux系统下inode满了导致无法写文件的解决思路
    MySQL5.7.20报错Access denied for user 'root'@'localhost' (using password: NO)
    深浅拷贝
    集合
    列表 元组 range
    机器码和字节码
    函数
    文件操作
    小数据池和代码块
  • 原文地址:https://www.cnblogs.com/qz1234/p/5424967.html
Copyright © 2020-2023  润新知