MyException - 我的异常网
当前位置:我的异常网» C# » 新手怎么正确调用方法

新手怎么正确调用方法(2)

www.MyException.Cn  网友分享于:2013-12-21  浏览:6次

Console.WriteLine("输入姓名、学号、C#成绩、英语、数学");
this.name = Console.ReadLine();
this.code = Convert.ToInt32(Console.ReadLine());
this.csharp = Convert.ToInt32(Console.ReadLine());
this.english = Convert.ToInt32(Console.ReadLine());
this.mathm = Convert.ToInt32(Console.ReadLine());
}
public void output()
{
Console.WriteLine("{0,6} {1,4} {2,4} {3,4} {4,4} {5,4}", this.name, this.code, this.csharp, this.english, this.mathm, this.avers);
}
}


class Program
{
static void Main(string[] args)
{
int n;
Console.WriteLine("请输入人数");
n = Convert.ToInt32(Console.ReadLine());
score[] sc = new score[n];
for (int i = 0; i < n; i++)
{
sc[i] = new score(i);

for (int i = 0; i < n; i++)
sc[i].toave();
for (int i = 0; i < n - 1; i++)
for (int j = i + 1; j < n; j++)
{
score temp;
if (sc[i].Avers > sc[j].Avers)
{
temp = sc[j];
sc[j] = sc[i];
sc[i] = temp;
}
}

for (int i = 0; i < n; i++)
sc[i].output();
Console.ReadKey();
}
}
}

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有