C#控制台程序 学生管理系统

lj921314 2011-09-20 10:56:28
//不知道思路了,请问这个怎么实现呢,还要用到arraylist!

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication17
{
class stu
{
public object ArrayList() ;
public int age;
public string name;
public stu(string name, int age)
{
this.age = age; this.name = name;
}
}


class gl
{
stu[] ren=new stu[10000];
int id = 0;
public void tj(string name,int age)
{//添加学生
ren[id] = new stu(name, age);
Console.WriteLine("姓名:{0} 年龄:{1}",ren[id].name,ren[id].age);
}

public void sc(int id)
{//删除


}

public void xgxx(int id, string name)
{//修改学生信息

}

public void cx1(string name)
{//查询学生信息(姓名)

}

public void cx(int age)
{//查询学生信息(年龄)

}
}

class aaa
{


}

class Program
{
static void Main(string[] args)
{
//stu e = new stu();
//e.name = "";
//e.age = 18;
gl c = new gl();

ArrayList abc = new ArrayList();
abc.Add(c.tj);

Console.WriteLine("添加按1、删除按2、查询按3、修改按4、退出按5");
int a = Convert.ToInt32(Console.ReadLine());
while (a < 5)
{

if (a == 1)
{
Console.WriteLine("输入姓名");
string xm = Console.ReadLine();
Console.WriteLine("输入年龄");
int nl = Convert.ToInt32(Console.ReadLine());
c.tj(xm, nl);

}
if (a == 2)
{
Console.WriteLine("输入年龄");
int id = Convert.ToInt32(Console.ReadLine());
c.sc(id);

}
if (a == 3)
{
Console.WriteLine("按姓名查询 1 、按年龄查询 2");
int d = Convert.ToInt32(Console.ReadLine());
if (d == 1)
{
Console.WriteLine("输入姓名");
string name = Console.ReadLine();
c.cx1(name);
}
if (d == 2)
{
Console.WriteLine("输入年龄");
int id = Convert.ToInt32(Console.ReadLine());
c.cx(id);
}
if (d != 1 && d != 2)
{
Console.WriteLine("输入有误");
}
}
if (a == 4)
{
Console.WriteLine("输入年龄");
int id = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("输入姓名");
string name = Console.ReadLine();
c.xgxx(id, name);
}
Console.WriteLine("添加 1 \n删除 2 \n查询 3\n修改 4\n退出 5");
a = Convert.ToInt32(Console.ReadLine());
}
}
}
}
...全文
649 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
sihonglaoren 2011-09-21
  • 打赏
  • 举报
回复
这么简单的程序都不会,我看你还是转行算了。
sihonglaoren 2011-09-21
  • 打赏
  • 举报
回复
这么简单的程序都不会,我看你转行算了。
zh6335901 2011-09-21
  • 打赏
  • 举报
回复
LZ你这命名习惯。。你们老师没教你吗。。
iangenius 2011-09-21
  • 打赏
  • 举报
回复
呵呵,一般的信息管理系统,实际也就是对数据进行增、删、改的操作,当然这些增、删、改操作,如果为了应付考试或者毕业设计的话,就是通过控件去触发对数据库中数据的修改。如果想提高自己的能力的话,那你就好好对待这个。
krenyelang 2011-09-21
  • 打赏
  • 举报
回复
6楼的
你事直接飞过来得吗?
呵呵……
十年不笑 2011-09-20
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 return_false 的回复:]
目的很明确,就是对学生信息的增删改查
首先你要确定数据存储区:例如可以用哈希表
然后从主函数开始,一直到最后,都围绕这这张哈希表来进行操作,这是一条主线

你不会参加了什么培训吧?
[/Quote]

恭喜你,答对了。我做出来了,呵呵。
nkhuangyanping 2011-09-20
  • 打赏
  • 举报
回复
你主要想干什么呀?
  • 打赏
  • 举报
回复
目的很明确,就是对学生信息的增删改查
首先你要确定数据存储区:例如可以用哈希表
然后从主函数开始,一直到最后,都围绕这这张哈希表来进行操作,这是一条主线

你不会参加了什么培训吧?

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧