//不知道思路了,请问这个怎么实现呢,还要用到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());
            }
        }
    }
}

解决方案 »

  1.   

    目的很明确,就是对学生信息的增删改查
    首先你要确定数据存储区:例如可以用哈希表
    然后从主函数开始,一直到最后,都围绕这这张哈希表来进行操作,这是一条主线你不会参加了什么培训吧?
      

  2.   


    恭喜你,答对了。我做出来了,呵呵。
      

  3.   

    LZ你这命名习惯。。你们老师没教你吗。。
      

  4.   

    这么简单的程序都不会,我看你转行算了。
      

  5.   

    这么简单的程序都不会,我看你还是转行算了。
      

  6.   

    6楼的
    你事直接飞过来得吗?
       呵呵……
      

  7.   

    呵呵,一般的信息管理系统,实际也就是对数据进行增、删、改的操作,当然这些增、删、改操作,如果为了应付考试或者毕业设计的话,就是通过控件去触发对数据库中数据的修改。如果想提高自己的能力的话,那你就好好对待这个。