学生管理系统C++版(简单版)

有错请指出

头文件:

#include
#include
#include

类型:

struct Student
{
    char name[100];//名字
    int age;//年龄
    char sex;//性别
    int Maths;//数学成绩
    int Chinese;//语文成绩
    int English;//英语成绩
}xm[10000]; 

函数:

void add_student()//添加学生
{
    cout<<"请输入名字:";
    cin>>xm[y].name;
    cout<<"请输入年龄:";
    cin>>xm[y].age;
    cout<<"请输入性别(男输入m,女输入f):";
    cin>>xm[y].sex;
    y++;
}

void del_student()//删除最后一个学生 
{
    if(y>0)
    {
        y--;
    }
    else
    {
        cout<<"没有学生可删除!"<>v;//输入序号
    if(v<0 || v>=y)
    {
        cout<<"序号超出范围!"<>xm[v].Maths;
    cout<<"请输入语文成绩:";
    cin>>xm[v].Chinese;
    cout<<"请输入英语成绩:";
    cin>>xm[v].English;
} 

void list_column()//列出表格    
{
    for(int i=0;i

main:

int main()
{
    cout<<"\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t";
    cout<<"欢迎使用学生管理系统!";
    Sleep(3000);
    clearScreen();
    while(1){
        cout<<"+-----------------------------+\n";
        cout<<"|请选择您需要的功能           |\n";
        cout<<"|1.添加学生     	        	 |\n";
        cout<<"|2.删除最后一个学生           |\n";
        cout<<"|3.添加成绩                   |\n";
        cout<<"|4.列出表格                   |\n";
        cout<<"|0.退出                       |\n";
        cout<<"+-----------------------------+\n";
        cin>>x;
        switch(x)
        {
            case 1:
                add_student();
                break;
            case 2:
                del_student();
                Sleep(500);//等待,让用户看见
                break;
            case 3:
                add_score();
                break;
            case 4:
                list_column();
                Sleep(10000);//等待,让用户看见
                break;
            case 0:
                cout<<"真的退出吗?\n1.是\n2.我打错了\n";
                int asdf;
                cin>>asdf;
                switch (asdf) {
                    case 1:
                        return 0;
                    case 2:
                        break;
                    default:
                        cout<<"输出错误"<

完整代码:

//学生管理系统C++版
//头文件
#include
#include
#include
using namespace std;

int x,y=0;//x是输入,y是xm的下标,初始化y为0

//创建Student类型
struct Student
{
    char name[100];//名字
    int age;//年龄
    char sex;//性别
    int Maths;//数学成绩
    int Chinese;//语文成绩
    int English;//英语成绩
}xm[10000];

void add_student()//添加学生
{
    cout<<"请输入名字:";
    cin>>xm[y].name;
    cout<<"请输入年龄:";
    cin>>xm[y].age;
    cout<<"请输入性别(男输入m,女输入f):";
    cin>>xm[y].sex;
    y++;
}

void del_student()//删除最后一个学生 
{
    if(y>0)
    {
        y--;
    }
    else
    {
        cout<<"没有学生可删除!"<>v;//输入序号
    if(v<0 || v>=y)
    {
        cout<<"序号超出范围!"<>xm[v].Maths;
    cout<<"请输入语文成绩:";
    cin>>xm[v].Chinese;
    cout<<"请输入英语成绩:";
    cin>>xm[v].English;
} 

void list_column()//列出表格    
{
    for(int i=0;i>x;
        switch(x)
        {
            case 1:
                add_student();
                break;
            case 2:
                del_student();
                Sleep(500);//等待,让用户看见
                break;
            case 3:
                add_score();
                break;
            case 4:
                list_column();
                Sleep(10000);//等待,让用户看见
                break;
            case 0:
                cout<<"真的退出吗?\n1.是\n2.我打错了\n";
                int asdf;
                cin>>asdf;
                switch (asdf) {
                    case 1:
                        return 0;
                    case 2:
                        break;
                    default:
                        cout<<"输出错误"<

感谢您的观看 

 

 

 

你可能感兴趣的:(C++,c++,程序)