" />

欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C++實現(xiàn)考勤管理系統(tǒng)

 更新時間:2022年03月16日 08:58:27   作者:我不叫喂喂喂喂喂喂喂喂喂  
這篇文章主要介紹了C++實現(xiàn)考勤管理系統(tǒng),文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了C++實現(xiàn)考勤管理系統(tǒng)的具體代碼,供大家參考,具體內容如下

設計一考勤管理系統(tǒng),記錄學生的缺課情況

1、設計學生類;
2、設計課程類;
3、設計考勤類;
4、錄入學生的缺課情況;
5、修改某個學生的缺課情況;
6、查詢某個學生的缺課情況;
7、統(tǒng)計一段時間內,曠課學生的名單和次數(shù)

僅供參考,尚有不足,請多多指正!

#include <iostream>
#include <cstring>
using namespace std;

class Student
{
?? ?public:
?? ??? ?void setname(char *setname)
?? ??? ?{?? ?
?? ??? ??? ?strcpy(name,setname);
?? ??? ?}
?? ??? ?
?? ??? ?void setcarname(char *setcarname)
?? ??? ?{
?? ??? ??? ?strcpy(carname,setcarname);
?? ??? ?}
?? ??? ?
?? ??? ?void setseating_capacity(char *setseating_capacity)
?? ??? ?{
?? ??? ??? ?strcpy(seating_capacity,setseating_capacity);
?? ??? ?}
?? ??? ?
?? ??? ?void setidentifynumber(char *setidentifynumber)
?? ??? ?{
?? ??? ??? ?strcpy(identifynumber,setidentifynumber);
?? ??? ?}?
?? ??? ?
?? ??? ?char *getname()
?? ??? ?{
?? ??? ??? ?char *setname=name;
?? ??? ??? ?return setname;
?? ??? ?}
?? ??? ?
?? ??? ?char *getcarname()
?? ??? ?{
?? ??? ??? ?char *setcarname=carname;
?? ??? ??? ?return setcarname;
?? ??? ?}
?? ??? ?
?? ??? ?char *getsetseating_capacity()
?? ??? ?{
?? ??? ??? ?char *setseating_capacity=seating_capacity;
?? ??? ??? ?return setseating_capacity;
?? ??? ?}
?? ??? ?
?? ??? ?char *getidentifynumber()
?? ??? ?{
?? ??? ??? ?char *setidentifynumber=identifynumber;
?? ??? ??? ?return setidentifynumber;
?? ??? ?}
?? ??? ?
?? ??? ?
?? ?private:
?? ??? ?char name[30];
?? ??? ?char carname[30];
?? ??? ?char seating_capacity[30];
?? ??? ?char identifynumber[30];
};

class Course:public Student
{
?? ?public:
?? ??? ?void setcoursename(char *setcoursename)
?? ??? ?{
?? ??? ??? ?strcpy(coursename,setcoursename);
?? ??? ?}
?? ??? ?
?? ??? ?void setcoursetime(char *setcoursetime)
?? ??? ?{
?? ??? ??? ?strcpy(coursetime,setcoursetime);
?? ??? ?}?
?? ??? ??
?? ??? ?void setcourseplace(char *setcourseplace)
?? ??? ?{
?? ??? ??? ?strcpy(courseplace,setcourseplace);
?? ??? ?}
?? ??? ?
?? ??? ?char *getcoursename()
?? ??? ?{
?? ??? ??? ?char *setcoursename;
?? ??? ??? ?setcoursename=coursename;
?? ??? ??? ?return setcoursename;
?? ??? ?}
?? ??? ?
?? ??? ?char *getcoursetime()
?? ??? ?{
?? ??? ??? ?char *setcoursetime;
?? ??? ??? ?setcoursetime=coursetime;
?? ??? ??? ?return setcoursetime;
?? ??? ?}
?? ??? ?
?? ??? ?char *getcourseplace()
?? ??? ?{
?? ??? ??? ?char *setcourseplace;
?? ??? ??? ?setcourseplace=courseplace;
?? ??? ??? ?return setcourseplace;
?? ??? ?}
?? ??? ?
?? ?private:
?? ??? ?char coursename[30];
?? ??? ?char coursetime[30];
?? ??? ?char courseplace[30];
};?

class Attendence:public Course
{
?? ?public:
?? ??? ?void setattendence(int setattendence)
?? ??? ?{
?? ??? ??? ?int i=0;
?? ??? ??? ?attendence[i]=setattendence;
?? ??? ??? ?i++;
?? ??? ?}
?? ??? ?
?? ??? ?int *getattendence()
?? ??? ?{
?? ??? ??? ?int *setattendence;
?? ??? ??? ?setattendence=attendence;
?? ??? ??? ?return setattendence;
?? ??? ?}
?? ?private:
?? ??? ?int attendence[30];
};
?
int input(Student n[],Student i[],Course cn[],Course ct[],Course cp[],Attendence a[]);
int modify(Student i[],Course cn[],Course ct[],Course cp[],Attendence attendence[],int totalnumber);
int search(Student n[],Student i[],Course cn[],Course ct[],Course cp[],Attendence a[],int totalnumber);
int statistic(Student n[],Student i[],Course cn[],Course ct[],Course cp[],Attendence a[],int totalnumber);
void bubble(int arr[],int len);

Student n[20];
Student i[20];
Course cn[20];
Course ct[20];
Course cp[20];
Attendence a[20];

int totalnumber=0;
char name[30];
char identifynumber[30];
char coursename[30];
char coursetime[30];
char courseplace[30];
int attendence;
int array[30];

int att[30];

int main()?
{
?? ?while(1)
?? ?{
?? ??? ?cout<<"---------吉林大學珠海學院---------\n"
?? ??? ??? ?<<" ? ? ? ? 學生考勤管理系統(tǒng)\n\n"
?? ??? ??? ?<<" ? ? ?1.錄入學生缺課信息\n"
?? ??? ??? ?<<" ? ? ?2.修改學生缺課記錄\n"
?? ??? ??? ?<<" ? ? ?3.查詢學生缺課情況\n"
?? ??? ??? ?<<" ? ? ?4.統(tǒng)計一段時間內學生曠課情況\n"
?? ??? ??? ?<<" ? ? ?5.退出系統(tǒng)\n\n"
?? ??? ??? ?<<"------------------------------"<<endl;
?? ??? ??? ??? ?
?? ??? ?int num;
?? ??? ?for(;;)
?? ??? ?{
?? ??? ??? ?cout<<"請選擇需要執(zhí)行的功能序號(1-5):";
?? ??? ??? ?cin>>num;
?? ??? ??? ?if(num>=1&&num<=5)
?? ??? ??? ??? ?break;
?? ??? ??? ?else
?? ??? ??? ??? ?continue;
?? ??? ?}
?? ??? ?
?? ??? ?cout<<endl;
?? ?
?? ??? ?switch(num){
?? ??? ??? ?case 1:{
?? ??? ??? ??? ?input(n,i,cn,ct,cp,a);
?? ??? ??? ??? ?break;
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ??? ?case 2:{
?? ??? ??? ??? ?modify(i,cn,ct,cp,a,totalnumber);
?? ??? ??? ??? ?break;
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ??? ?case 3:{
?? ??? ??? ??? ?search(n,i,cn,ct,cp,a,totalnumber);
?? ??? ??? ??? ?break ;
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ??? ?
?? ??? ??? ?case 4:{
?? ??? ??? ??? ?statistic(n,i,cn,ct,cp,a,totalnumber);
?? ??? ??? ??? ?break;
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ??? ?case 5:exit(0);?
?? ??? ?}
?? ?}?? ?
}

int input(Student n[],Student i[],Course cn[],Course ct[],Course cp[],Attendence a[])
{
?? ?cout<<"----------請開始輸入----------\n";
?? ??? ?cout<<"請輸入將錄入系統(tǒng)的人數(shù):";?
?? ??? ?cin>>totalnumber;
?? ??? ?cout<<endl;
?? ?
?? ?for(int counter=0;counter<totalnumber;counter++)
?? ?{
?? ??? ?cout<<"學生姓名:";
?? ??? ?cin>>name;?
?? ??? ?n[counter].setname(name);
?? ??? ?cout<<"學生學號:";
?? ??? ?cin>>identifynumber;
?? ??? ?i[counter].setidentifynumber(identifynumber);
?? ??? ?cout<<"課程名稱:";
?? ??? ?cin>>coursename;
?? ??? ?cn[counter].setcoursename(coursename);
?? ??? ?cout<<"課程時間(星期幾,第幾節(jié)課):";
?? ??? ?cin>>coursetime;
?? ??? ?ct[counter].setcoursetime(coursetime);
?? ??? ?cout<<"課程地點:";
?? ??? ?cin>>courseplace;
?? ??? ?cp[counter].setcourseplace(courseplace);
?? ??? ?cout<<"缺課次數(shù):";
?? ??? ?cin>>attendence;
?? ??? ?a[counter].setattendence(attendence);
?? ??? ?array[counter]=attendence;
?? ??? ?cout<<'\n';
?? ?}
?? ?
?? ?return 1;
}


int modify(Student i[],Course cn[],Course ct[],Course cp[],Attendence a[],int totalnumber)
{
?? ?int inputnumber;
?? ?do{
?? ??? ?char id[8];
?? ??? ?cout<<"請輸入學生學號:";
?? ??? ?cin>>id;
?? ??? ?cout<<endl;
?? ?
?? ??? ?if(1)
?? ??? ?{
?? ??? ??? ?for(int counter=0;counter<totalnumber;counter++)
?? ??? ??? ?{
?? ??? ??? ??? ?if(strcmp(id,i[counter].getidentifynumber())==0)
?? ??? ??? ??? ?{
?? ??? ??? ??? ??? ?int num;
?? ??? ??? ??? ??? ?cout<<"請選擇需要修改信息的種類:"
?? ??? ??? ??? ??? ??? ?<<"\n1.課程名稱\n"
?? ??? ??? ??? ??? ??? ?<<"2.課程時間\n"
?? ??? ??? ??? ??? ??? ?<<"3.課程地點\n"
?? ??? ??? ??? ??? ??? ?<<"4.缺課次數(shù)\n";
?? ??? ??? ??? ??? ??? ?
?? ??? ??? ??? ??? ?for(;;)
?? ??? ??? ??? ??? ?{
?? ??? ??? ??? ??? ??? ?cout<<"請輸入需要修改信息的代號(1-4):";
?? ??? ??? ??? ??? ??? ?cin>>num;
?? ??? ??? ??? ??? ??? ?if(num>=1&&num<=4)
?? ??? ??? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ??? ??? ?else
?? ??? ??? ??? ??? ??? ??? ?continue;
?? ??? ??? ??? ??? ?}?
?? ??? ??? ??? ??? ?
?? ??? ??? ??? ??? ?cout<<endl;
?? ??? ??? ??? ?
?? ??? ??? ??? ??? ?switch(num){
?? ??? ??? ??? ??? ??? ?case 1:{
?? ??? ??? ??? ??? ??? ??? ?cout<<"請輸入修改后的課程名稱:";?
?? ??? ??? ??? ??? ??? ??? ?cin>>coursename;
?? ??? ??? ??? ??? ??? ??? ?cn[counter].setcoursename(coursename);
?? ??? ??? ??? ??? ??? ??? ?cout<<'\n';
?? ??? ??? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?
?? ??? ??? ??? ??? ??? ?case 2:{
?? ??? ??? ??? ??? ??? ??? ?cout<<"請輸入修改后的課程時間(星期幾,第幾節(jié)課):";
?? ??? ??? ??? ??? ??? ??? ?cin>>coursetime;
?? ??? ??? ??? ??? ??? ??? ?ct[counter].setcoursetime(coursetime);
?? ??? ??? ??? ??? ??? ??? ?cout<<'\n';
?? ??? ??? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?
?? ??? ??? ??? ??? ??? ?case 3:{
?? ??? ??? ??? ??? ??? ??? ?cout<<"請輸入修改后的課程地點:";
?? ??? ??? ??? ??? ??? ??? ?cin>>courseplace;
?? ??? ??? ??? ??? ??? ??? ?cp[counter].setcourseplace(courseplace);
?? ??? ??? ??? ??? ??? ??? ?cout<<'\n';
?? ??? ??? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?
?? ??? ??? ??? ??? ??? ?case 4:{
?? ??? ??? ??? ??? ??? ??? ?cout<<"請輸入修改后的缺課次數(shù):";
?? ??? ??? ??? ??? ??? ??? ?cin>>attendence;
?? ??? ??? ??? ??? ??? ??? ?a[counter].setattendence(attendence);
?? ??? ??? ??? ??? ??? ??? ?array[counter]=attendence;
?? ??? ??? ??? ??? ??? ??? ?cout<<'\n';
?? ??? ??? ??? ??? ??? ??? ?break;
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?}
?? ??? ??? ?}?
?? ??? ?}
?? ??? ??? ? ?? ??
?? ??? ?else
?? ??? ?{
?? ??? ??? ?cout<<"無該學生缺課信息!\n"
?? ??? ??? ??? ?<<"請再次確認輸入學號無誤\n\n";
?? ??? ?}
?? ??? ??? ?
?? ??? ?for(;;)
?? ??? ?{
?? ??? ??? ?cout<<"重新查詢請輸入1|返回目錄請輸入0\n";?
?? ??? ??? ?cin>>inputnumber;
?? ??? ??? ?if(inputnumber==1||inputnumber==0)
?? ??? ??? ??? ?break;
?? ??? ??? ?else
?? ??? ??? ??? ?continue;
?? ??? ?}
?? ??? ?
?? ??? ?
?? ?}while(inputnumber==1);
?? ?
?? ?return 1;
}

int search(Student n[],Student i[],Course cn[],Course ct[],Course cp[],Attendence a[],int totalnumber)
{
?? ?int inputnumber;
?? ?do{
?? ??? ?char ids[8];
?? ??? ?char *identify=ids;
?? ??? ?cout<<"請輸入學生學號:";
?? ??? ?cin>>ids;
?? ??? ?cout<<endl;
?? ??? ?strcpy(ids,identify);
?? ?
?? ??? ?if(1)
?? ??? ?{
?? ??? ??? ?for(int counter=0;counter<totalnumber;counter++)
?? ??? ??? ?{
?? ??? ??? ??? ?if(strcmp(ids,i[counter].getidentifynumber())==0)
?? ??? ??? ??? ?{
?? ??? ??? ??? ??? ?cout<<"學生姓名:"<<n[counter].getname()
?? ??? ??? ??? ??? ??? ?<<"\n學生學號:"<<i[counter].getidentifynumber()
?? ??? ??? ??? ??? ??? ?<<"\n缺課課程名稱:"<<cn[counter].getcoursename()
?? ??? ??? ??? ??? ??? ?<<"\n缺課課程日期:"<<ct[counter].getcoursetime()
?? ??? ??? ??? ??? ??? ?<<"\n缺課時間:"<<cp[counter].getcourseplace()
?? ??? ??? ??? ??? ??? ?<<"\n缺課次數(shù):"<<*a[counter].getattendence()<<"\n";
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?}
?? ??? ??? ??? ?
?? ??? ?else
?? ??? ??? ?cout<<"無該同學數(shù)據";?
?? ??? ??? ??? ?break;
?? ??? ?
?? ??? ?cout<<'\n'<<endl;
?? ??? ?for(;;)
?? ??? ?{
?? ??? ??? ?cout<<"重新查詢請輸入1|返回目錄請輸入0\n\n";
?? ??? ??? ?cin>>inputnumber;
?? ??? ??? ?if(inputnumber==0||inputnumber==1)
?? ??? ??? ??? ?break;
?? ??? ??? ?else
?? ??? ??? ??? ?continue;
?? ??? ?}
?? ??? ?
?? ?}while(inputnumber==1);
?? ?
?? ?return 1;
}

int statistic(Student n[],Student i[],Course cn[],Course ct[],Course cp[],Attendence a[],int totalnumber)
{
?? ?int inputnumber;
?? ?for(int index=0;index<30;index++)
?? ??? ?att[index]=index;
?? ?
?? ?if(totalnumber==0)
?? ?cout<<"數(shù)據庫無信息\n\n";
?? ?
?? ?else if(totalnumber==1)
?? ?cout<<"學生姓名:"<<n[0].getname()
?? ??? ?<<"\n學生學號:"<<i[0].getidentifynumber()
?? ??? ?<<"\n缺課課程名稱:"<<cn[0].getcoursename()
?? ??? ?<<"\n缺課課程日期:"<<ct[0].getcoursetime()
?? ??? ?<<"\n缺課時間:"<<cp[0].getcourseplace()
?? ??? ?<<"\n缺課次數(shù):"<<*a[0].getattendence()<<"\n\n";
?? ?
?? ?else if(1)
?? ?{
?? ??? ?for(int counter=0;counter<totalnumber;counter++)
?? ??? ?{
?? ??? ??? ?if(a[counter].getattendence()<a[counter].getattendence()+1)
?? ??? ??? ?{
?? ??? ??? ??? ?bubble(array,totalnumber);
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ??? ?else if(a[counter].getattendence()==a[counter+1].getattendence())
?? ??? ??? ?{
?? ??? ??? ??? ?if(strcmp(i[counter].getidentifynumber(),i[counter+1].getidentifynumber())>0)
?? ??? ??? ??? ?{
?? ??? ??? ??? ??? ?int temp;
?? ??? ??? ??? ??? ?int a=counter;
?? ??? ??? ??? ??? ?int b=counter+1;
?? ??? ??? ??? ??? ?
?? ??? ??? ??? ??? ?temp=a;
?? ??? ??? ??? ??? ?a=b;
?? ??? ??? ??? ??? ?b=temp;
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ?}

?? ??? ?for(int index=0;index<totalnumber;index++)
?? ??? ?{
?? ??? ??? ?cout<<"學生姓名:"<<n[att[index]].getname()
?? ??? ??? ??? ?<<"\n學生學號:"<<i[att[index]].getidentifynumber()
?? ??? ??? ??? ?<<"\n缺課課程名稱:"<<cn[att[index]].getcoursename()
?? ??? ??? ??? ?<<"\n缺課課程日期:"<<ct[att[index]].getcoursetime()
?? ??? ??? ??? ?<<"\n缺課時間:"<<cp[att[index]].getcourseplace()
?? ??? ??? ??? ?<<"\n缺課次數(shù):"<<*a[att[index]].getattendence()<<"\n\n";
?? ??? ?}
?? ??? ?
?? ?}
?? ?
?? ?cout<<"返回目錄請輸入0\n";
?? ?cin>>inputnumber;
?? ?if(inputnumber==0)
?? ??? ?return 1;
}

void bubble(int arr[],int len)
{
?? ?int i,j,temp;
?? ?int t;
?? ?for(i=0;i<len-1;i++)
?? ?{
?? ??? ?for(j=0;j<len-1-i;j++)
?? ??? ?{
?? ??? ??? ?if(arr[j]<arr[j+1])
?? ??? ??? ?{
?? ??? ??? ??? ?temp=arr[j];
?? ??? ??? ??? ?arr[j]=arr[j+1];
?? ??? ??? ??? ?arr[j+1]=temp;?? ?
?? ??? ??? ?
?? ??? ??? ??? ?t=att[j];
?? ??? ??? ??? ?att[j]=att[j+1];
?? ??? ??? ??? ?att[j+1]=t;?
?? ??? ??? ?}
?? ??? ?}
?? ?}
}

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

  • Qt+FFMPEG實現(xiàn)循環(huán)解碼詳解

    Qt+FFMPEG實現(xiàn)循環(huán)解碼詳解

    這篇文章主要為大家詳細介紹了如何利用Qt+FFMPEG實現(xiàn)循環(huán)解碼功能,文中的示例代碼講解詳細,對我們學習Qt有一定幫助,需要的可以參考一下
    2022-08-08
  • C++超詳細講解構造函數(shù)與析構函數(shù)的用法及實現(xiàn)

    C++超詳細講解構造函數(shù)與析構函數(shù)的用法及實現(xiàn)

    構造函數(shù)主要作用在于創(chuàng)建對象時為對象的成員屬性賦值,構造函數(shù)由編譯器自動調用,無須手動調用;析構函數(shù)主要作用在于對象銷毀前系統(tǒng)自動調用,執(zhí)行一?些清理工作
    2022-05-05
  • 深入理解二叉樹的非遞歸遍歷

    深入理解二叉樹的非遞歸遍歷

    本篇文章是對二叉樹的非遞歸遍歷進行了詳細的分析介紹,需要的朋友參考下
    2013-05-05
  • pcre函數(shù)詳細解析

    pcre函數(shù)詳細解析

    PCRE提供了19個接口函數(shù),為了簡單介紹,使用PCRE內帶的測試程序(pcretest.c)示例用法
    2013-09-09
  • opencv實現(xiàn)讀取視頻保存視頻

    opencv實現(xiàn)讀取視頻保存視頻

    這篇文章主要為大家詳細介紹了opencv實現(xiàn)讀取視頻保存視頻,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-01-01
  • C++類的定義和對象的創(chuàng)建詳解

    C++類的定義和對象的創(chuàng)建詳解

    本篇文章重點講解了兩種創(chuàng)建對象的方式:一種是在棧上創(chuàng)建,形式和定義普通變量類似;另外一種是在堆上使用 new 關鍵字創(chuàng)建,必須要用一個指針指向它,下面和小編一起來學習下面為文章的內容
    2021-09-09
  • C語言數(shù)據結構之單向鏈表詳解分析

    C語言數(shù)據結構之單向鏈表詳解分析

    鏈表可以說是一種最為基礎的數(shù)據結構了,而單向鏈表更是基礎中的基礎。鏈表是由一組元素以特定的順序組合或鏈接在一起的,不同元素之間在邏輯上相鄰,但是在物理上并不一定相鄰。在維護一組數(shù)據集合時,就可以使用鏈表,這一點和數(shù)組很相似
    2021-11-11
  • 使用C/C++語言生成一個隨機迷宮游戲

    使用C/C++語言生成一個隨機迷宮游戲

    迷宮相信大家都走過,主要是考驗你的邏輯思維。今天小編使用C語言生成一個隨機迷宮游戲,具體實現(xiàn)代碼,大家通過本文學習吧
    2016-12-12
  • 用C# 控制Windows系統(tǒng)音量的實現(xiàn)方法

    用C# 控制Windows系統(tǒng)音量的實現(xiàn)方法

    本篇文章是對使用C#控制Windows系統(tǒng)音量的實現(xiàn)方法進行了詳細的分析介紹,需要的朋友參考下
    2013-05-05
  • Qt實現(xiàn)進程間通信

    Qt實現(xiàn)進程間通信

    這篇文章主要為大家詳細介紹了Qt實現(xiàn)進程間通信,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-08-08

最新評論