程序设计大作业---学生体测信息管理系统(数组、文件、c++)

整个系统包括三个文件:学生信息文件、体育信息文件、密码文件、

main.cpp

#include <iostream>
#include <algorithm>
#include <windows.h>
#include <conio.h>
#include "paixu.h"
#include "data.h"
#include "basic.h"
#include "file.h"
#include "password.h"
#include "menu.h"
#include "sport.h"
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <windows.h>

using namespace std;


int main(){
    system("color b2");
    system("cls");
    welcome();
    int j = 0;
    for(int i = 3;i >= 1;i--){
        password();
        if(flag == 1)
            break;
        else{
            if(i - 1 == 0)
            {
                Sleep(500);
                break;
            }
            printf("密码错误,您还有%d次机会!\n",i-1);
            Sleep(500);
        }
    }
    if(flag == 1){
        printf("密码正确\n");
        Sleep(500);
        system("cls");
        while(1)
        {
            j++;
            Sleep(500);
            Student stu[500];
            sport spo[500];
            readstu();
            if(j >= 2){
                printf("按任意键返回");
                getch();
                system ("cls");
            }
            printf("请输入您要选择的功能键:\n");
            menu();//功能菜单
            int n = getch();
            switch(n)
            {
                case '0'://退出
                    printf("谢谢使用!");
                    exit(0);
                case '1'://增加学生信息
                    stu_add();//增加新的学生
                    savestu();
                    break;
                case '2'://删除学生信息
                    delete1();//删除学生
                    savestu();
                    break;
                case '3'://改变学生的信息
                    change();//改变学生信息
                    savestu();
                    break;
                case '4'://查找某个学生的信息
                    search1();//按学号查找学生并输出该生信息
                    break;
                case '5':// 对bmi进行排序
                    mysort();
                    break;
                case '6'://输出所有学生的信息
                    glanceall();
                    break;
                case '7':
                    menu1();
                    int m = getch();
                    switch(m){
                    case '0':
                        break;
                    case '1':
                        addsport();
                        if(flag2 == 0)
                            stu_addscore();
                        savestu();
                        break;
                    case '2':
                        delsport();
                        savestu();
                        break;
                    case '3':
                        changesport();
                        savestu();
                        break;
                    case '4':
                        glanceallsport();
                        break;
                    default:
                        printf("请输入正确的选择\n");
                        break;
                    }
            }
        }
    }
}

data.h

#ifndef _data_h_
#define _data_h_

#include <iostream>
#include <algorithm>
#include <windows.h>
#include <conio.h>

using namespace std;

struct Student{
        char name[100];
        char number[20];
        char sex[2];
        int age;
        int weight;
        int height;
        float BMI()
        {
            return (double)weight / pow((double)height / 100, 2);
        }
        int sport_score[100];
};

struct sport{
    int sport_num;
    char sport_name[20];
};


Student stu[500];
char nam[100];
char num[20];
char sex1[2];
int age1;
int wei;
int hei;
int count1 = 0;
char code[20];
int flag = 0;

sport spo[500];
int sportnum;
char sportname[20];
int sum = 0;
int flag2 = 0;
int number5;

#endif

file.h

#ifndef _file_h_
#define _file_h_

#include "
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值