栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

基于c++控制台实现的学生和教师体温上报系统

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

基于c++控制台实现的学生和教师体温上报系统

就是简易的控制台程序:

#include 
#include 
#include 
#include 

using namespace std;

struct Student
{
    int id=0;
    char college[20];
    char grade[20];
    float temperature=0.0;
};

int main()
{
    vector Students;
    Student stu1;
    stu1.id=2001;
    memcpy(&stu1.college,"机械",20);
    memcpy(&stu1.grade,"机械一班",20);

    Student stu2;
    stu2.id=2002;
    memcpy(&stu2.college,"机械",20);
    memcpy(&stu2.grade,"机械一班",20);

    Students.push_back(stu1);
    Students.push_back(stu2);

    //stu1.college="机械";
    //教师登录账号和密码  1001  123456
    //学生初始没有账号和密码   由老师进行创建  账号位 学号,密码位 123456
    int n=0;
    while(true)
    {
        printf("1.教师端登录n");
        printf("2.学生端登录n");
        printf("3.退出n");
        scanf("%d",&n);
        if(n==1)
        {
            printf("请输入教师的账号和密码n");
            int account=0;
            int password=0;
            scanf("%d%d",&account,&password);
            if(account==1001&&password==123456)
            {
                while(true)
                {
                    printf("1.查询所有学生体温n");
                    printf("2.查询异常学生温度n");
                    printf("3.修改学生体温n");
                    printf("4.退出n");
                    scanf("%d",&n);
                    if(n==1)
                    {
                        for(int i=0;i
                            printf("学号:%d 学院:%s 年级:%s 体温:%fn",Students[i].id,Students[i].college,
                                   Students[i].grade,Students[i].temperature);
                        }
                    }
                    else if(n==2)
                    {
                        for(int i=0;i
                            if(Students[i].temperature>37.3)
                            {
                                printf("学号:%d 学院:%s 年级:%s 体温:%fn",Students[i].id,Students[i].college,
                                       Students[i].grade,Students[i].temperature);
                            }
                        }
                    }
                    else if(n==3)
                    {
                        printf("请输入要修改体温的学生学号n");
                        int id=0;
                        scanf("%d",&id);
                        bool isSelct=false;
                        for(int i=0;i
                            if(id==Students[i].id)
                            {
                                isSelct=true;
                                printf("请输入需改的温度n");
                                float temp=0.0;
                                scanf("%f",&temp);
                                Students[i].temperature=temp;
                            }
                        }
                        if(!isSelct)
                            printf("未找到学号n");
                    }
                    else if(n==4)
                    {
                        break;
                    }
                }
            }
            else
            {
                printf("用户名和密码错误,请重新选择n");
            }
        }
        else if(n==2)
        {
            printf("请输入学生的账号和密码n");
            int account=0;
            int password=0;
            scanf("%d%d",&account,&password);
            bool isSelect=false;
            for(int i=0;i
                if(account==Students[i].id)
                {
                    isSelect=true;
                }
            }
            if(isSelect)
            {
                if(password==123456)
                {
                    while(true)
                    {
                        printf("1.上报体温n");
                        printf("2.退出n");
                        int input;
                        scanf("%d",&input);
                        if(input==1)
                        {
                            printf("请输入你的体温n");
                            float temp=0;
                            scanf("%f",&temp);
                            for(int i=0;i
                                if(account==Students[i].id)
                                {
                                    Students[i].temperature=temp;
                                    printf("更新成功n");
                                }
                            }
                        }
                        else if(input==2)
                        {
                            break;
                        }
                    }
                }
                else
                {
                    printf("用户名或密码错误,重新输入n");
                }
            }

        }
        else if(n==3)
        {
            break;
        }


    }
    return 0;


}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/960050.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号