急求高手(集合)

来源:百度知道 编辑:UC知道 时间:2024/06/18 17:28:03
public struct AA
{
public int _No, _Age, _Success;
public string _Name;
}
class Student
{
ArrayList student = new ArrayList();
string [] Caption = new string[4] { "学号", " 姓名", " 年龄", " 成绩" };
AA aa = new AA();

Console.WriteLine("请输入学生学号:");
aa._No = Int32.Parse(Console.ReadLine());

Console.WriteLine("请输入学生姓名:");
aa._Name = Console.ReadLine();

Console.WriteLine("请输入学生年龄:");
aa._Age = Int32.Parse(Console.ReadLine());

Console.WriteLine("请输入学生成绩:");
aa._Success = Int32.Parse(Console.ReadLine());
student.Add(aa);

for (int i = 0; i < Caption.Length; i++)
{
Console.Write(Captio

你原来的代码结构有问题,而且只是输入一个数据,达不到循环读取的效果,所以把你的代码做了下调整。
public struct AA
{
public int _No, _Age, _Success;
public string _Name;
}
class Student
{
ArrayList student = new ArrayList();
string[] Caption = new string[4] { "学号", " 姓名", " 年龄", " 成绩" };
AA aa = new AA();

public void run()
{
string goOn;
do
{
Console.WriteLine("请输入学生学号:");
aa._No = Int32.Parse(Console.ReadLine());

Console.WriteLine("请输入学生姓名:");
aa._Name = Console.ReadLine();

Console.WriteLine("请输入学生年龄:");
aa._Age = Int32.Parse(Console.ReadLine());

Console.WriteLine("请输入学生成绩:");
aa.