创建一个学生(Student)类,它有学号(no),姓名(name),C#成绩(CSharpScore)三个成员变量,成员方法自己定义。要求创建一个Student数组,初始化若干名学生数据,然后将其按CSharpScore成绩升序排列,并打印出所有学生的信息。
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ArrayList myArrayList = new ArrayList();
Gerbil a = new Gerbil(4);
Gerbil b = new Gerbil(5);
Gerbil c = new Gerbil(6);
Gerbil d = new Gerbil(7);
Gerbil e = new Gerbil(8);
myArrayList.Add(a);
myArrayList.Add(b);
myArrayList.Add(c);
myArrayList.Add(d);
myArrayList.Add(e);
foreach (Gerbil aGerbil in myArrayList)
{
aGerbil.hop();
}
}
}
class Gerbil
{
public int gerbilNumber;
public Gerbil(int Number)
{
gerbilNumber = Number;
}
public void hop()
{
Console.WriteLine(gerbilNumber);
}
}
}
为什么写成using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{