求大神来帮助C#,怎么修改

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{

class Student
{
    public static int sno=0;
    string sname;
    char cno;
    float score;

    public void SetName(string name)
    {
        sname = name;
    }
    public string Sno { get; set; }
    public string Sname { get; set; }
    public string Cno { get; set; }
    public float Score { get; set; }
    public Student(string sno,string sname,string cno,float score)
    {
        this.Sno = sno;
        this.Sname = sname;
        this.Cno = cno;
        this.Score = score;
    }

}

class Control
{
    public void Login()
    {
    }
    public void StudentMenu()
    {

    }
    public void TeacherMenu()
    {

    }
    public void Exit()
    {

    }
}
class Operating
{
    public void Student()
    {

    }

    public void AddStudent(Student s)
    {
        Console.WriteLine("Name:");
        string n = Console.ReadLine();
        s.SetName(n);
        Student.SortStudentByNo++;

    }

    void DellStudent(Student[] a,int pos)
    {

    }
    void ModStudent(Student[] a, int pos)
    {

    }
    void SortStudentByNo(Student[] a)
    {
        int i, j, temp;
        for(i=0;i<a.Length;i++)
        {
            for(j=i;j<a.Length-i-1;j++)
            {
                if(a[j].sno>a[j+1].sno)
                {

                }
            }
        }
    }
    public void FindStudent(Student[] a, string name)
    {
        int i;
        for(i=0;i<a.Length;i++)
        {
            if(a[i].Sname==name)
            {
                Console.WriteLine("找到{0}同学", name);
                break;
            }
        }
        if(i==a.Length)
        {
            Console.WriteLine("没有找到{0}同学", name);
        }
    }
    /*
    void StaScore(Student a[])
    {

    }*/
}
class Program
{

    static void Main(string[] args)
    {
        Console.WriteLine("************************");
        DateTime.Now.ToString();
        Console.WriteLine("************************");;
        const int MAX = 500;
        Student[] s = new Student[MAX];
        Control cc = new Control();
        cc.Login();
        Operating oo = new Operating();
        oo.AddStudent(a[Student.sno]);

     }
}

}

c#

2个回答

我在你的Student里面都没有找到SortStudentByNo..... 你是怎么++的....

你说的怎么改是指逻辑有错误吗?还是说优化方面

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!