求解释哪里错了。
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 类
{
public class student //定义一个类
{
public string name;
public float score1;
public float score2;
public float score3;
public float sum(float s1, float s2,float s3)
{this.score1=s1;
this.score2=s2;
this.score3=s3;
return score1+score2+score3;
}
public float ave(float s1, float s2,float s3)
{this.score1=s1;
this.score2=s2;
this.score3=s3;
return (score1+score2+score3)/3;
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int i = 0;
float n = 0, m = 0, s1, s2, s3;
student[] stu = new student[44];
Random rnd = new Random();
stu[i].name = ((char)rnd.Next(65, 97)).ToString() + ((char)rnd.Next(65, 97)).ToString() + ((char)rnd.Next(65, 97)).ToString();//姓名
s1 = (float)rnd.Next(1, 100);// 分数1
s2 = (float)rnd.Next(1, 100);//分数2
s3 = (float)rnd.Next(1, 100);//分数3
n = stu[i].sum(s1, s2, s3);//总分
m = stu[i].ave(s1, s2, s3);//平均分
textBox1.Text = Convert.ToString(stu[i].name);
textBox2.Text = Convert.ToString(s1);
textBox3.Text = Convert.ToString(s2);
textBox4.Text = Convert.ToString(s3);
textBox5.Text = Convert.ToString(n);
textBox6.Text = Convert.ToString(m);
}
}
}
}
谁能给我正确的写法啊