日期:2014-05-17  浏览次数:21016 次

新手 运行报错“未将对象引用设置到对象的实例”,求大神解,谢谢
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace lab_6_1
{


    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        class student
        {
            public String name;
            public int numbel;
            public double e_num;
            public double m_num;
            public double c_num;

            public student(String name, int numbel, double e_num, double m_num, double c_num)
            {
                this.name = name;
                this.numbel = numbel;
                this.e_num = e_num;
                this.m_num = m_num;
                this.c_num = c_num;
            }

            public student()
            {
                // TODO: Complete member initialization
            }
            public string GetMassage()
            {
                return string.Format("姓名:{0},学号:{1},英语成绩:{2},数学成绩:{3},计算机成绩{4}.",
                    this.name, this.numbel, this.e_num, this.m_num, this.c_num);
            }

            public double average()
            {
                double avg = (e_num + m_n