您的位置:首页 > 编程语言 > C#

适合初学者看的学生信息系统,C#小白编写

2018-03-20 10:44 190 查看
建了两个类
第一个学生类



第二个教师类



代码如下,加入了四个学生using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HomeWork
{
class Program
{
static void Main(string[] args)
{

student stu = new student();
student zhang = new student();
zhang.Name = "小明";
zhang.No = 1;
zhang.Tel = 999;
zhang.Stature = 170;

            student li = new student();
li.Name = "小张";
li.No = 2;
li.Tel = 888;
li.Stature = 175;

            student hong = new student();
hong.Name = "小红";
hong.No = 4;
hong.Tel = 666;
hong.Stature = 165;

            student ming = new student();
ming.Name = "小李";
ming.No = 3;
ming.Tel = 777;
ming.Stature = 178;

            teacher tea = new teacher();
List<student> List = new List<student>();
List.Add(zhang);
List.Add(li);
List.Add(ming);
List.Add(hong);
for(int i = 1; i>0; i++)
{
Console.WriteLine("请问要查询哪位学生的信息?");
Console.WriteLine("输入学号1-4单个查看,输入5则查看全部,输入6退出。");
int flag = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("************************************");
if (flag == 1)
{
tea.Teacher(zhang);
}
if (flag == 2)
{
tea.Teacher(li);
}
if (flag == 3)
{
tea.Teacher(ming);
}
if (flag == 4)
{
tea.Teacher(hong);
}
if (flag == 5)
{
tea.teache(List);
}
if(flag == 6)
{
break;
}

}

Console.ReadLine();
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  C#
相关文章推荐