爱问知识人 爱问教育 医院库

C 学生学籍管理系统

首页

C 学生学籍管理系统

请高手帮忙做一个C  学生学籍管理系统,内容很简单的。
1,输入学生的学号,姓名,班级
2,查询,按学号查,按姓名查询。
3,输出已经记录的学生信息

提交回答

全部答案

    2018-06-06 04:45:26
  •   #include 
    #include
    #include
    using namespace std;
    struct Student
    {
    string id;
    string name;
    string grade;
    };
    struct Studnum
    {
    Student * p;
    int num; //输入的记录数
    };
    //使用后要释放空间
    Studnum input()
    {
    Studnum stu;
    stu。
      num=0;
    stu。p=new Student[10]; //先分配十个空间存放记录
    int n=10; //已分配空间个数
    for(;;){
    if(stu。
      num == (n-1))
    stu。p=(Student*)realloc(stu。p,sizeof(Student)*n*2); //重新分配空间*2
    cout>stu。
      p[stu。num]。id;
    if(stu。p[stu。num ]。id=="quit")
    return stu;
    cin>>stu。
      p[stu。num]。name;
    cin>>stu。p[stu。num]。grade;
    stu。num;
    }
    return stu;
    }
    //i 0 查学号, 1查姓名
    void search(Studnum stu,string str,int i)
    {
    int j,k; //循环变量
    if(stu。
      p==NULL)
    return;
    if(i==0){
    for(j=0;j>";
    int i;
    cin>>i;
    switch(i){
    case 1:
    stu=input();
    break;
    case 2:
    cout>str;
    cout>i;
    search(stu,str,i);
    break;
    case 3:
    print(stu);
    break;
    case 4:
    delete [] stu。
      p;
    return 0;
    default:
    cout<<"选项错误!"< }
    }
    }。
      

    s***

    2018-06-06 04:45:26

类似问题

换一换

相关推荐

正在加载...
最新问答 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):