跪求C#程序!创建一个student类,设计用于表示学生的姓名、学号和语文、数学、英语成绩的字段

作者&投稿:弓非 (若有异议请与网页底部的电邮联系)
设计一个学生类Cstudent,该类包括学生学号、姓名以及数学、英语、c语言成绩等数据成员;~

void print(struct student *);
void input(struct student *);

struct student
{
int num;
char name[20];
int score[3];
}stu[10];

struct student *p;

void main()
{
p = stu;
input(p);
print(p);
system("pause");
}

void input(struct student *p)
{
int i = 0, j;
for(p = stu; p < stu + 2; p++, i++)
{
printf("请输入第%d个人的学号:", i + 1);
scanf("%d",&p->num);
printf("请输入第%d个人的姓名:", i + 1);
scanf("%s",&p->name);
for(j = 0; j < 3; j++)
{
printf("请输入他第%d门课的成绩:", j + 1);
scanf("%d",&p->score[j]);
}
}
p = stu;
}

void print(struct student *p)
{
int num, j;
float avg, sum = 0;
struct student *q;
num = p->score[0];
for(q = p; q < p + 2; q++)
{
for(j = 0; j < 3; j++)
{
if(q->score[j] > num)
num = q->score[j];
sum += q->score[j];
}
}
avg = sum / 3 * 2;
printf("%f%d
", avg, num); //找出最大的一个然后比较,找到最大的那个所在的哪一个stu[i],然后输出这个组的所有数据就搞定···
for(q = p; q < p + 2; q++)
{
for(j = 0; j < 3; j++)
if(q->score[j] == num)
{
printf("%d%s
",q->num, q->name);
for(j = 0; j < 3; j++)
printf("%d",q->score[j]);
printf("
");
break;
}
}
}

public class CStudent { private string name; public string Name { get { if (string.IsNullOrEmpty(name)) return ""; else return name; } set { name = value; } } private string studentID; public string StudentID { get { if (string.IsNullOrEmpty(studentID)) return ""; else return studentID; } set { studentID = value; } } private string achievement; public string Achievement { get { if (string.IsNullOrEmpty(achievement)) return ""; else return achievement; } set { achievement = value; } } private string age; public string Age { get { if (string.IsNullOrEmpty(age)) return ""; else return age; } set { age = value; } } public CStudent(string name, string studentID, string achievement,string age) { this.Name = name; this.StudentID = studentID; this.Achievement = achievement; this.Age = age; } public void Display() { Console.WriteLine(string.Format("学生姓名:{0}",this.Name)); Console.WriteLine(string.Format("学生学号:{0}",this.StudentID)); Console.WriteLine(string.Format("学生成绩:{0}",this.Achievement)); Console.WriteLine(string.Format("学生年龄:{0}",this.Age)); } }

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);
//怎么显示就不演示了,有多种方法,我不清楚你要怎么显示,用什么控件

}
}
}

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;
}
}
}

你是要Web程序还是Windows应用程序?


三角形中的c怎么求
(1)在直角三角形中满足勾股定理—在平面上的一个直角三角形中,两个直角边边长的平方加起来等于斜边长的平方,数学表达式:a²+b²=c²(2)a²+b²=c²,求c,因为c是一条边,所以就是求大于0的一个根。即c=√(a²+b²)。

化学有关求算c的几个基本公式
c = n \/ V c = n \/ V = (m\/M) \/ (m\/ρ) = M\/ρ

怎样求出c?高中数学
先求出c,c^2=a^2+b^2-2ab*cosC,再开根号求出c,再根据正弦定理:a\/sinA=c\/sinC,求出A

怎样求出c?高中数学
先求出c,c^2=a^2+b^2-2ab*cosC,再开根号求出c,再根据正弦定理:a\/sinA=c\/sinC,求出A

怎么求组合数C
求组合数C的方法 1、当n,m都很小的时候可以利用杨辉三角直接求。C(n,m)=C(n-1,m)+C(n-1,m-1);2、利用乘法逆元 乘法逆元:(a\/b)%mod=a*(b^(mod-2)) mod为素数。逆元可以利用扩展欧几里德或欧拉函数求得。3、当n和m比较大,mod是素数且比较小的时候(10^5左右),通过Lucas...

c是怎么求出来的?
1、运算符%的运算结果就是左操作数除以右操作数后所得的余数。下面举一个通例来说明:a%b假设a\/b=c(余数为d)对于上面的例子,左操作数为a,右操作数为b,那么a%b后的结果为d。2、值得注意的是运算符%的左右操作数必须都为int型。运算符%最基本的应用就是判断奇偶性(a%2),还有就是用在...

怎么求数学常数c
利用“欧拉公式”1+1\/2+1\/3+……+1\/n=ln(n)+C,(C为欧拉常数)Sn=1+1\/2+1\/3+…+1\/n>ln(1+1)+ln(1+1\/2)+ln(1+1\/3)+…+ln(1+1\/n)=ln[2*3\/2*4\/3*…*(n+1)\/n]=ln(n+1)

高中物理,c是怎么求的
LC)t=π√(LC)\/2=T\/4 从U=Um开始计时,t=0时,电容器两端电压为U=Um,电容器带电荷量为Q=CUm 经t=T\/4,U=0,电容器放电完毕,Q=0 则在Δt=T\/4时间内,通过电路某横截面的电荷量为ΔQ=Q=CUm 平均电流为I=ΔQ\/Δt=CUm\/[π√(LC)\/2]=2Um\/π·√(C\/L)C对。

如何求排列组合中的C值?
排列组合中的C计算公式为:C(n,m)=n!\/(m!(n-m)!)。其中n!表示n的阶乘,即n×(n-1)×(n-2)×...×3×2×1。举个例子,如果需要从5个不同的元素中取出3个元素进行组合,那么C(5,3)的计算方法为:C(5,3)=5!\/(3!×2!)=10。这个公式的意思是,从5个不...

定积分的常数C怎么求啊?
在数学的殿堂中,定积分是微积分的核心概念,它就像一个隐藏的谜团,其中的常数C,尽管看似简单,却在求解过程中扮演着至关重要的角色。实际上,C并非总是需要我们去求解,它更像是一个预留的变量,其值在特定问题中才会浮出水面。特殊情况下求解C 当你面临一个需要计算初始位置和速度的物理系统时,...

崇仁县18277955193: 用C#设计一个学生类,该类能够记录学生姓名、出生年月、班级、成绩和科目等信息. -
屠虎美天: class Project{ string proName; double proScore; }; class StudentInfor{ string stuName; dateTime stuBirth; string stuClass; Project projects[N]; };

崇仁县18277955193: 在C#中用数据库怎么创建一个学生信息的程序 -
屠虎美天: 选择开始菜单中→程序→【Management SQL Server 2008】→【SQL Server Management Studio】命令,打开【SQL Server Management Studio】窗口,并使用Windows或 SQL Server身份验证建立连接.在【对象资源管理器】窗口中展开服...

崇仁县18277955193: c#设计一个程序定义Student类 -
屠虎美天: 我写了个样例,你看一下,先定义Studentpublic class Student{public string Name { get; set; }private DateTime _birthday;public DateTime Birthday{get { return _birthday; }set { _birthday = value; }}public int Age{get { return DateTime....

崇仁县18277955193: 用C#定义一个student类,该类具有数据成员myName,number,myAge及属性Name,Age,Number, -
屠虎美天: public class Student{private string myName;public string Name{get { return myName; }set { myName = value; }} private static int number;public static int Number{get { return number; }} private int myAge;public int Age{get { return ...

崇仁县18277955193: c#、构造一个Student类,要求,有两个实例属性 public long xh; 和 public string xm; -
屠虎美天: 1. this.xh=new long();2. this.xm=new string();3. long _xh,string _xm;4. new Student();5. new Student(参数1,参数2);6. b的坐标?你tm逗我呢

崇仁县18277955193: 、编写一个程序,要求创建一个Student类,添加name和age属性,为该属性添加相应的gett? -
屠虎美天: 代码如下 class Student{private String name;private int age;public void setName(String name){this.name = name;}public void setAge(int age){this.age = age;}public String getName(){return name;}public int getAge(){return age;} } 如果有帮助到你,请点击采纳

崇仁县18277955193: 用c#创建学生结构体 -
屠虎美天: using System; namespace ConsoleApplication1 { /// <summary> /// 学生结构体 /// </summary> public struct Student { /// <summary> /// 学号 /// </summary> public int Id;/// <summary> /// 姓名 /// </summary> public string Name; /// <summary> /// 性别 ...

崇仁县18277955193: c#创建一个学生类,添加私有字符串类型 -
屠虎美天: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { public class Student { private string m_name; public string Name { get { return m_name; } ...

崇仁县18277955193: 用c#编写,创建一个access数据库Exam.mdb,在其中创建表student,字段(Num,N -
屠虎美天: 先在程序中添加对Microsoft ADO Ext 2.8的引用,然后 string db = Application.StartupPath + @"\Exam.mdb"; string connstr = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", db); ADOX.Catalog catalog = new Catalog(); ...

崇仁县18277955193: C#怎么创建一个具有10条记录的学生信息表students -
屠虎美天: 跟普通的C#连接数据库一样,把建表语句按照格式写好,放到commandText中,然后再执行就可以了.PS:这种操作如果不是问了答题,一般都是先在数据库里面写好存储过程再来执行新增操作.

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网