学生信息管理系统(c++)
来源:互联网 发布:mysql latin1 编辑:程序博客网 时间:2024/04/29 03:50
学生信息管理系统(c++)
该课程设计含有两个模块:
(1)教师权限模块
(2)学生权限模块
学生权限模块含有1)增加2)显示3)追加4)查找 学生信息功能
教师权限模块含有1)增加2)显示3)追加4)查找 5)修改 6)删除 学生信息功能
用到的主要知识
(1)类 (2)继承(3)结构体(4)循环(5)数组(6)函数
实现各功能模块的主线:
(1)输入密码,进入不同权限的菜单界面
(2)进入菜单界面,做出不同的选择,调用相关函数,进入不同功能模块
(3)进行不同的功能模块,进行操作之后,实现相应功能
(4)退出系统
缺点:
(1)首先必须输入一些学生信息,才能进行各种操作
(2)没有添加文件,将学生信息保存入文件
(3)不能动态实现学生信息的输入,浪费内存空间
#include<iostream>
#include<string>
#include<stdlib.h>
using namespace std;
typedef struct stu//定义一个结构体作为类的私有成员
{
int num;
string name;
};
class student //学生类为基类
{
protected:
stu a[100];
int i, n;
static int d;//计算输入学生总数
public:
student();//构造函数
char menu();//菜单界面
void activity();//进行各种操作的一个平台
void input();//输入函数
void display(); //显示函数
void append();//追加函数
void searach();//查找函数
};
class teacher:public student
{
public:
teacher():student(){};
//下面几个函数是对其他函数的重定义
char menu();//增加了其他函数的菜单界面
void activity();//进行各种操作的一个平台
void mod();//修改函数
void shanchu();//删除函数
};
int student::d=0;//计数器赋值为0
student::student()//构造函数
{
cout<<"****welcome to the student`s information systerm ****"<<endl;
}
char student::menu()//学生菜单界面
{
char m;
cout<<"*********1:input the student`s information***********"<<endl;
cout<<"*********2:display the student`s information*********"<<endl;
cout<<"*********3:append the student`s information**********"<<endl;
cout<<"*********4:searach the student`s information*********"<<endl;
cout<<"*****************0:quit the systerm*****************"<<endl;
cout<<"*****************please input one number![ ]\b\b\b\b";
cin>>m;
return m;
}
char teacher::menu()//教师菜单界面
{
char m;
cout<<"*********1:input the student`s information***********"<<endl;
cout<<"*********2:display the student`s information*********"<<endl;
cout<<"*********3:append the student`s information**********"<<endl;
cout<<"*********4:searach the student`s information*********"<<endl;
cout<<"*********5:mod the student`s information*************"<<endl;
cout<<"*********6:shanchu the student`s information*********"<<endl;
cout<<"*****************0:quit the systerm*****************"<<endl;
cout<<"*****************please input one number![ ]\b\b\b\b";
cin>>m;
return m;
}
void student::activity()//学生各种操作界面
{
char k;
while(1)
{
k=menu();
switch (k)
{
case '1':input();break;
case '2':display();break;
case '3':append();break;
case '4':searach();break;
case '0':cout<<"**********thanks you !bye bye**********!"<<endl;return ;
default:cout<<"you are wrong!"<<endl;
}
}
}
void teacher::activity()//教师各种操作界面
{
char k;
while(1)
{
k=menu();
switch (k)
{
case '1':input();break;
case '2':display();break;
case '3':append();break;
case '4':searach();break;
case '5':mod();break;
case '6':shanchu();break;
case '0':cout<<"**********thanks you !bye bye**********!"<<endl;return ;
default:cout<<"you are wrong!"<<endl;
}
}
}
void student:: input()//输入函数
{
cout<<"please input one counter about student numbers!"<<endl;
cin>>n;
for(i=0;i<n;i++)
{ cout<<"the student`s num is :"<<endl;
cin>>a[i].num;
cout<<"the student`s name is : "<<endl;
cin>>a[i].name;
d++;
}
cout<<"the work is done! "<<endl;
display();
}
void student::display()//显示函数
{
cout<<"the student`s num : name"<<endl;
for(i=0;i<d;i++)
{
cout<<" "<<a[i].num<<" "<<a[i].name<<endl;
}
}
void student::append()//追加
{
int m;
cout<<"please input the counter numbers for append student~s information!"<<endl;
cin>>m;
for(i=n;i<n+m;i++)
{
cout<<"the student`s num is :"<<endl;
cin>>a[i].num;
cout<<"the student`s name is : "<<endl;
cin>>a[i].name;
d++;
}
cout<<"the work is done! "<<endl;
display();
}
void student::searach()//查找
{
int nu,g=0;
cout<<"please the student`s num"<<endl;
cin>>nu;
for(i=0;i<d;i++)
{
if(a[i].num==nu)
{
cout<<"the student`s num : name"<<endl;
cout<<" "<<a[i].num<<" "<<a[i].name<<endl;
g=1;
}
}
if(g==0)
cout<<"not found the student`s information!"<<endl;
cout<<"the work is done!"<<endl;
}
void teacher::mod()//修改
{
int nu;
cout<<"please input the student`s num"<<endl;
cin>>nu;
for(i=0;i<d;i++)
{
if(nu==a[i].num)
{
cout<<"the student`s num is :"<<endl;
cin>>a[i].num;
cout<<"the student`s name is : "<<endl;
cin>>a[i].name;
}
}
cout<<"the work is done! "<<d<<endl;
display();
}
void teacher::shanchu()//删除函数
{ int nu,s=-1;
cout<<"please input the student`s number!";
cin>>nu;
for(i=0;i<=d;i++)
{
if(nu==a[i].num)
{s=i;
for(i=s+1;i<d;i++)
{
a[i-1].num=a[i].num;
a[i-1].name=a[i].name;
}
d--;
}
}
if(s==-1)
cout<<"not found the student`s information!"<<endl;
cout<<"the work is done! "<<endl;
display();
}
void stu()//一级菜单,进入学生操作界面
{
student stud;
stud.activity();
}
void teach()//一级菜单,进入教师操作界面
{
teacher t;
t.activity();
}
int main()
{
char c;
cout<<"&&&&&&welcome to the student`s information systerm&&&&&&"<<endl;
cout<<"&&&&&&&&&&&&&&&s: 学生身份&&&&&&&&&&&&&&&"<<endl;
cout<<"&&&&&&&&&&&&&&&t: 教师身份&&&&&&&&&&&&&&&"<<endl;
cout<<"please input one character for cheek the password![ ]\b\b\b";
cin>>c;
switch(c)
{
case 's': stu();break;
case 't':teach();break;
default :cout<<"you are wrong !";
}
return 0;
}
学生信息管理系统(c++)
该课程设计含有两个模块:
(1)教师权限模块
(2)学生权限模块
学生权限模块含有1)增加2)显示3)追加4)查找 学生信息功能
教师权限模块含有1)增加2)显示3)追加4)查找 5)修改 6)删除 学生信息功能
用到的主要知识
(1)类 (2)继承(3)结构体(4)循环(5)数组(6)函数
实现各功能模块的主线:
(1)输入密码,进入不同权限的菜单界面
(2)进入菜单界面,做出不同的选择,调用相关函数,进入不同功能模块
(3)进行不同的功能模块,进行操作之后,实现相应功能
(4)退出系统
缺点:
(1)首先必须输入一些学生信息,才能进行各种操作
(2)没有添加文件,将学生信息保存入文件
(3)不能动态实现学生信息的输入,浪费内存空间
#include<iostream>
#include<string>
#include<stdlib.h>
using namespace std;
typedef struct stu//定义一个结构体作为类的私有成员
{
int num;
string name;
};
class student //学生类为基类
{
protected:
stu a[100];
int i, n;
static int d;//计算输入学生总数
public:
student();//构造函数
char menu();//菜单界面
void activity();//进行各种操作的一个平台
void input();//输入函数
void display(); //显示函数
void append();//追加函数
void searach();//查找函数
};
class teacher:public student
{
public:
teacher():student(){};
//下面几个函数是对其他函数的重定义
char menu();//增加了其他函数的菜单界面
void activity();//进行各种操作的一个平台
void mod();//修改函数
void shanchu();//删除函数
};
int student::d=0;//计数器赋值为0
student::student()//构造函数
{
cout<<"****welcome to the student`s information systerm ****"<<endl;
}
char student::menu()//学生菜单界面
{
char m;
cout<<"*********1:input the student`s information***********"<<endl;
cout<<"*********2:display the student`s information*********"<<endl;
cout<<"*********3:append the student`s information**********"<<endl;
cout<<"*********4:searach the student`s information*********"<<endl;
cout<<"*****************0:quit the systerm*****************"<<endl;
cout<<"*****************please input one number![ ]\b\b\b\b";
cin>>m;
return m;
}
char teacher::menu()//教师菜单界面
{
char m;
cout<<"*********1:input the student`s information***********"<<endl;
cout<<"*********2:display the student`s information*********"<<endl;
cout<<"*********3:append the student`s information**********"<<endl;
cout<<"*********4:searach the student`s information*********"<<endl;
cout<<"*********5:mod the student`s information*************"<<endl;
cout<<"*********6:shanchu the student`s information*********"<<endl;
cout<<"*****************0:quit the systerm*****************"<<endl;
cout<<"*****************please input one number![ ]\b\b\b\b";
cin>>m;
return m;
}
void student::activity()//学生各种操作界面
{
char k;
while(1)
{
k=menu();
switch (k)
{
case '1':input();break;
case '2':display();break;
case '3':append();break;
case '4':searach();break;
case '0':cout<<"**********thanks you !bye bye**********!"<<endl;return ;
default:cout<<"you are wrong!"<<endl;
}
}
}
void teacher::activity()//教师各种操作界面
{
char k;
while(1)
{
k=menu();
switch (k)
{
case '1':input();break;
case '2':display();break;
case '3':append();break;
case '4':searach();break;
case '5':mod();break;
case '6':shanchu();break;
case '0':cout<<"**********thanks you !bye bye**********!"<<endl;return ;
default:cout<<"you are wrong!"<<endl;
}
}
}
void student:: input()//输入函数
{
cout<<"please input one counter about student numbers!"<<endl;
cin>>n;
for(i=0;i<n;i++)
{ cout<<"the student`s num is :"<<endl;
cin>>a[i].num;
cout<<"the student`s name is : "<<endl;
cin>>a[i].name;
d++;
}
cout<<"the work is done! "<<endl;
display();
}
void student::display()//显示函数
{
cout<<"the student`s num : name"<<endl;
for(i=0;i<d;i++)
{
cout<<" "<<a[i].num<<" "<<a[i].name<<endl;
}
}
void student::append()//追加
{
int m;
cout<<"please input the counter numbers for append student~s information!"<<endl;
cin>>m;
for(i=n;i<n+m;i++)
{
cout<<"the student`s num is :"<<endl;
cin>>a[i].num;
cout<<"the student`s name is : "<<endl;
cin>>a[i].name;
d++;
}
cout<<"the work is done! "<<endl;
display();
}
void student::searach()//查找
{
int nu,g=0;
cout<<"please the student`s num"<<endl;
cin>>nu;
for(i=0;i<d;i++)
{
if(a[i].num==nu)
{
cout<<"the student`s num : name"<<endl;
cout<<" "<<a[i].num<<" "<<a[i].name<<endl;
g=1;
}
}
if(g==0)
cout<<"not found the student`s information!"<<endl;
cout<<"the work is done!"<<endl;
}
void teacher::mod()//修改
{
int nu;
cout<<"please input the student`s num"<<endl;
cin>>nu;
for(i=0;i<d;i++)
{
if(nu==a[i].num)
{
cout<<"the student`s num is :"<<endl;
cin>>a[i].num;
cout<<"the student`s name is : "<<endl;
cin>>a[i].name;
}
}
cout<<"the work is done! "<<d<<endl;
display();
}
void teacher::shanchu()//删除函数
{ int nu,s=-1;
cout<<"please input the student`s number!";
cin>>nu;
for(i=0;i<=d;i++)
{
if(nu==a[i].num)
{s=i;
for(i=s+1;i<d;i++)
{
a[i-1].num=a[i].num;
a[i-1].name=a[i].name;
}
d--;
}
}
if(s==-1)
cout<<"not found the student`s information!"<<endl;
cout<<"the work is done! "<<endl;
display();
}
void stu()//一级菜单,进入学生操作界面
{
student stud;
stud.activity();
}
void teach()//一级菜单,进入教师操作界面
{
teacher t;
t.activity();
}
int main()
{
char c;
cout<<"&&&&&&welcome to the student`s information systerm&&&&&&"<<endl;
cout<<"&&&&&&&&&&&&&&&s: 学生身份&&&&&&&&&&&&&&&"<<endl;
cout<<"&&&&&&&&&&&&&&&t: 教师身份&&&&&&&&&&&&&&&"<<endl;
cout<<"please input one character for cheek the password![ ]\b\b\b";
cin>>c;
switch(c)
{
case 's': stu();break;
case 't':teach();break;
default :cout<<"you are wrong !";
}
return 0;
}
- 学生信息管理系统(c++)
- C#-学生信息管理系统
- 学生信息管理系统(C++)
- 学生信息管理系统(c语言)
- 学生信息管理系统(C语言)
- 学生信息管理系统(C语言)
- 学生信息管理系统(C实现)
- C语言学生信息管理系统(单链表)
- 单链表构建学生信息管理系统(C++)
- 学生信息管理系统(c/c++)
- 学生信息管理系统C实现
- C语言学生信息管理系统
- c语言学生信息管理系统
- 学生信息管理系统 c语言
- object c 学生信息管理系统
- 学生成绩信息管理系统(c++)
- C语言:学生信息管理系统
- c语言学生信息管理系统
- 64 bit Federal 18 下配置Android SDK环境
- 友元类
- 批量删除
- linux命令
- DirectUI的初步分析一
- 学生信息管理系统(c++)
- 久久网络收藏夹
- linux_rm
- form表单底下的button按钮点击自动提交恶心问题的解决
- 8版本控制工具svn
- winsock client & server
- verilog学习记(快速入门)
- install Python 3.3 on Ubuntu 12.04
- Entity Framework 实体关系总结