用C#编程 3.建立一个学生类,该学生类有学号、姓名、和考试成绩五个成员...
发布网友
发布时间:2024-10-24 02:25
我来回答
共1个回答
热心网友
时间:2024-11-06 06:48
3.class Student
{
private string id;
public string Id
{
get { return id; }
set { id = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private string success;
public string Success
{
get { return success; }
set { success = value; }
}
public Student()
{
}
public Student(string id)
{
this.id = id;
}
}
4.public struct Student
{
public string id;
public string name;
public string success;
}
class MyClass
{
Student s;
public void Print()
{
s.id = "id";
s.name = "name";
s.success = "success";
Console.Write(s.id);
Console.Write(s.name);
Console.Write(s.success);
}
}
5。int temp = b;b=a;a=temp;