跪求C#程序!创建一个student类,设计用于表示学生的姓名、学号和语文、数学、英语成绩的字段
创建一个student类,设计用于表示学生的姓名、学号和语文、数学、英语成绩的字段,然后再主程序中创建student类的实例,并输入学生的成绩,输入完成后,讲学生的姓名、...
创建一个student类,设计用于表示学生的姓名、学号和语文、数学、英语成绩的字段,然后再主程序中创建student类的实例,并输入学生的成绩,输入完成后,讲学生的姓名、学号和3门功课的成绩在窗体上显示成一行
展开
3个回答
展开全部
namespace WindowsFormsApplication1
{
class Student
{
public Student(string name, string no, int chinese, int math, int english)
{
this.Name = name;
this.No = no;
this.Chinese = chinese;
this.Math = math;
this.English = english;
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private string no;
public string No
{
get { return no; }
set { no = value; }
}
private int chinese;
public int Chinese
{
get { return chinese; }
set { chinese = value; }
}
private int math;
public int Math
{
get { return math; }
set { math = value; }
}
private int english;
public int English
{
get { return english; }
set { english = value; }
}
}
}
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Student students = new Student("张三", "no123", 60, 67, 34);
//怎么显示就不演示了,有多种方法,我不清楚你要怎么显示,用什么控件
}
}
}
{
class Student
{
public Student(string name, string no, int chinese, int math, int english)
{
this.Name = name;
this.No = no;
this.Chinese = chinese;
this.Math = math;
this.English = english;
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private string no;
public string No
{
get { return no; }
set { no = value; }
}
private int chinese;
public int Chinese
{
get { return chinese; }
set { chinese = value; }
}
private int math;
public int Math
{
get { return math; }
set { math = value; }
}
private int english;
public int English
{
get { return english; }
set { english = value; }
}
}
}
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Student students = new Student("张三", "no123", 60, 67, 34);
//怎么显示就不演示了,有多种方法,我不清楚你要怎么显示,用什么控件
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public class Stu
{
public string Name;
public string No;
public string Chinese;
public string Math;
public string English;
public Stu()
{ }
}
Stu st1 = new Stu();
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
this.label4.Text="";
st1.Chinese = textBox1.Text;
st1.English = textBox2.Text;
st1.Math = textBox3.Text;
this.label4.Text = "语文:" + st1.Chinese + "英语:" + st1.English + "数学:" + st1.Math;
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public class Stu
{
public string Name;
public string No;
public string Chinese;
public string Math;
public string English;
public Stu()
{ }
}
Stu st1 = new Stu();
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
this.label4.Text="";
st1.Chinese = textBox1.Text;
st1.English = textBox2.Text;
st1.Math = textBox3.Text;
this.label4.Text = "语文:" + st1.Chinese + "英语:" + st1.English + "数学:" + st1.Math;
}
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你是要Web程序还是Windows应用程序?
追问
要Windows应用程序的
追答
做个个小程序如图:可以打包给你
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询