C++实现校园运动会报名系统

这篇文章主要为大家详细介绍了C++实现校园运动会报名系统,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

本文为大家分享了C++实现校园运动会报名系统的具体代码,供大家参考,具体内容如下

main.cpp 

 #include "Campus.h" #include "List.h" /*校园运功会报名系统  实现报名信息录入 和 展示 */ /* 信息录入 1 . 建立运动会项目信息表 , 字段包括 , 项目编号 , 项目名称 , 学生姓名 ,院系 ,班级 ,性别 年龄,参赛时间 ,报名时间 ; 2  完成运动会报名信息新增页 , 3 查询报名 情况 4管理员系统可以更改报名截止时间 和 运动员的可想更改 (可以改成英文版和中文版切换) */ int main() { ShowPage(); return 0; }

Campush.h 

 #ifndef CAMPUS_H #define CAMPUS_H #include "List.h" void ShowPage(); void MenuChoose(); // 主菜单 void Apply_System();// 报名系统 void Show_Apply_System(); // 报名系统页面 void Apply_Information_Query();// 信息查询 void show_in_AdSYstem();// 管理员展示页面 void Administrator_System();// 管理员系统; void Athlete_Information(); // 运动员信息查询 void Sport_item_sign(); // 运动项目报名 void printList_new(Message &M); // 打印带有项目的信息 bool Judge_IF_sign(char *) ; // 判断学生是否报名项目 void Point_Base_Me(char *Temp); // 打印运动员信息 void AD_Menu(); // 管理员系统菜单 void Manage_system();// 管理员系统 void Log_Administrator(); void AD_Menu2(); void Cancel_signup(); void Revise_Data(); void Enter_Adsystem(); // 管理员登录 bool Judge_IF_Past_due();// 判断是否逾期; extern void Go_back1(); // 返回第一页 extern void Go_back2(); // 返回第二页; extern void Go_back3(); extern void Go_back4(); #endif // CAMPUS_H

List.cpp

 #include "List.h" #include "Campus.h" #include  #include  #include  #include  #include  using namespace std ; void Gettime_f(int &year ,int &month ,int &day ,int &hours ,int &minutes ,int &second ) { /*获取本地时间 */ time_t now ; struct tm *tm_now ; time(&now) ; tm_now = localtime(&now) ; year = tm_now->tm_year+1900 ; month = tm_now->tm_mon+1 ; day = tm_now->tm_mday ; hours = tm_now->tm_hour ; minutes = tm_now->tm_min ; second = tm_now->tm_sec ; return ; } Status List::CreatList(LinkList &L,int n) { // 创建链表; int i ; time_t now ; struct tm *tm_now ; time(&now) ; tm_now = localtime(&now) ; LinkList p ; LinkList head =NULL ; LinkList Last ; for(i=0 ; i> p->data.name ; cout<>p->data.IDcard ; cout<> p->data.gender; cout<> p->data.age ; cout<> p->data.Institute ; cout<> p->data.Class; cout<data.sport_it1,"000"); strcpy(p->data.sport_it2,"000");*/ p->next = NULL ; Gettime_f(p->data.Join_time.year ,p->data.Join_time.month ,p->data.Join_time.day ,p->data.Join_time.hours ,p->data.Join_time.minutes ,p->data.Join_time.second) ; if(head == NULL) head = p ; else { Last->next = p ; } Last = p ; } L = head ; FILE_Memory(L); cout<< " 信息录用成功"<< endl; return OK ; } Status List::GetElem(LinkList &L,int i ,Message &e) { /* 条件:线性表存在; 操作结果 : 如果 i 合法 得到线性表第i位置上的元素,反馈给e ; L 是不带头结点的; */ LinkList p ; if(!L) { cout<<" GetElem failed"<=i) break ; ++k; p = p->next ; } if(!p || k>i) { cout<<"没找到"<data ; return OK ; } Status List::printList(LinkList &L ) { /* 打印线性表 */ LinkList p = L ; while(p) { cout<<"姓名 : " <data.name <data.IDcard <data.gender<data.age<data.Institute<data.Class<data.Join_time.year<<"-"<data.Join_time.month<<"-"<< p->data.Join_time.day <<" "<data.Join_time.hours<<":"<data.Join_time.minutes<<":"<data.Join_time.second<next ; } return OK; } void FILE_Memory(LinkList &L) { FILE *fin ; int res ; char m[MAX] ; char n[MAX] ; char Name[MAX] ; LinkList p = L; if(L==NULL) { cout<<"L is NULL "<data.IDcard),".txt")); int Judge = ScanRepetition(T) ;// 扫描是否有重名; if(Judge == 0) // 存在返回0 { char ch ; cout<<"你输入的学号已经被录入或者您输入的学号有误,请不要重复录入. "<data.IDcard ) ; strcpy(n,strcat(Name, ".txt")); // zhs.txt strcpy(m,Path1); // D://dos//SportSystem// strcat(m,n); // D://dos//SportSystem//zhs.txt } fin = fopen(m,"a+"); if( !fin) { cout<<"Creat_fin ERROR "<data.IDcard ,p->data.name,p->data.age,p->data.gender ,p->data.Institute, p->data.Class ,p->data.Join_time.year ,p->data.Join_time.month , p->data.Join_time.day ,p->data.Join_time.hours ,p->data.Join_time.minutes, p->data.Join_time.second); memset(m,'\0',sizeof(m)); memset(n,'\0',sizeof(n)); memset(Name,'\0',sizeof(Name)); memset(cpy_Path,'\0',sizeof(cpy_Path)) ; memset(T,'\0',sizeof(T)); p = p->next ; } fclose(fin); return ; } int ScanRepetition(char *file_name) { // 扫描 ; /* int  access(const  char  *filename,  int  amode); amode参数为0时表示检查文件的存在性,如果文件存在,返回0,不存在,返回-1。 */ return access(file_name,0); } 

List.h

 #ifndef LIST_H #define LIST_H #include  #include  #include  #include  #define OK 1 #define ERROR 0 #define UNFOUND -1 #define Path1 "D:\\dos\\SportSystem\\" using namespace std ; const int MAX = 200 ; typedef int Status ; typedef int ElemType ; typedef struct AD_number{ char num[MAX]; char password[MAX]; }AD; typedef struct Person{ char num[MAX] ; char name[MAX] ; }Per; typedef struct Data_location{ int year ; int month ; int day ; int hours ; int minutes ; int second ; }Data; typedef struct Athlete_Message{ char IDcard[MAX] ; char name[MAX] ; // 姓名 char gender ; // 性别 int age ; char Institute[MAX] ; // 学院 char Class[MAX] ;// 班级; Data Join_time; // char sport_it1[MAX] ; // 项目一 char sport_it2[MAX] ; // 项目二 }Message; typedef struct node{ Message data ; struct node *next ; }LNode, *LinkList; class List { public: Status CreatList(LinkList &L,int n) ; Status GetElem(LinkList &L,int i ,Message &e) ; Status printList(LinkList &L ) ; private : Message e ; }; int ScanRepetition(char * ); void FILE_Memory(LinkList &L); void Srearch_city_fiction(FILE *fp); void Gettime_f(int &year ,int &month ,int &day ,int &hours ,int &minutes ,int &second ); #endif // LIST_H

Campus.cpp

 #include "Campus.h" #include "List.h" #include  #define Path2 "D:\\dos\\Administrator\\" void ShowPage() { cout<> n ; a.CreatList(L,n); cout<<" 身份信息确认 "<<"[y/n]"<<" "; cin >>ch1 ; if(ch1=='y') { cout<<" 确认成功 "<>ch2 ; if(ch2=='y') { a.printList(L); Sleep(500); } Go_back1(); return ; } void Show_Apply_System() { int index ; cout<>index ; if(index == 1) { Apply_System();// 录用信息 } else if(index ==2 ) { LinkList L ; cout<<"运动项目报名"<>Id ; strcpy(Cpy_path1,Path1) ; strcat(Cpy_path1,Id); strcat(Cpy_path1,".txt"); if(ScanRepetition(Cpy_path1) == -1) { cout<<"没有该学生信息"<> M.sport_it1 >> M.sport_it2 ; cin >> t1 >> t2 ; int i = 0 ; int flag1 , flag2 ; while(!feof(fin)) { fscanf(fin , "%s %s",p[i].num ,p[i].name); i++ ; } int j = 0 ; while(j<=i) { if (strcmp(t1 , p[j].num)==0) { flag1 = j ; } if (strcmp(t2 , p[j].num)==0) { flag2 = j ; } j++ ; } strcpy(M.sport_it1 , p[flag1].name); strcpy(M.sport_it2 , p[flag2].name); fprintf(fIDCARD,"%s %s",M.sport_it1 ,M.sport_it2); rewind(fIDCARD); fscanf(fIDCARD,"%s %s %d %c %s %s %d %d %d %d %d %d %s %s",M.IDcard ,M.name ,&M.age ,&M.gender ,M.Institute ,M.Class, &M.Join_time.year ,&M.Join_time.month ,&M.Join_time.day ,&M.Join_time.hours ,&M.Join_time.minutes,&M.Join_time.second, M.sport_it1,M.sport_it2); cout<<"选择成功"<> t1 >> t2 ; int i = 0 ; int flag1 , flag2 ; while(!feof(fin)) { fscanf(fin , "%s %s",p[i].num ,p[i].name); if (strcmp(t1 , p[i].num)==0) { flag1 = i ; } if (strcmp(t2 , p[i].num)==0) { flag2 = i ; } i++ ; } strcpy(M.sport_it1 , p[flag1].name); strcpy(M.sport_it2 , p[flag2].name); fprintf(fIDCARD,"%s %s",M.sport_it1 ,M.sport_it2); rewind(fIDCARD); fscanf(fIDCARD,"%s %s %d %c %s %s %d %d %d %d %d %d %s %s",M.IDcard ,M.name ,&M.age ,&M.gender ,M.Institute ,M.Class, &M.Join_time.year ,&M.Join_time.month ,&M.Join_time.day ,&M.Join_time.hours ,&M.Join_time.minutes,&M.Join_time.second, M.sport_it1,M.sport_it2); cout<<"选择成功"<>id_register ; strcpy(Temp,Path1); strcat(id_register,".txt"); strcat(Temp,id_register); if(ScanRepetition(Temp)== -1 ) { cout<<"没有该生的相关信息!"<>id_register ; strcpy(Temp,Path1); strcat(id_register,".txt"); strcat(Temp,id_register); if(ScanRepetition(Temp)== -1) { cout<<"没有该生的相关信息!"<>ch ; if(ch=='y') { system("cls"); ShowPage(); } else { cout<<"服务器错误00044xx"<>ch ; if(ch=='y') { system("cls"); Show_Apply_System(); } else { cout<<"服务器错误00044xx"<>ch ; if(ch=='y') { system("cls"); show_in_AdSYstem(); } else { cout<<"服务器错误00044xx"<>ch ; if(ch=='y') { system("cls"); Manage_system(); } else { cout<<"服务器错误00044xx"<>admin.num ; strcat(Temp,admin.num); strcat(Temp,".txt"); cout<>admin.password ; cout<>Pass_word ; if(strcmp(admin.password,Pass_word) == 0 ) {// 密码正确 并且文件不存在 if(ScanRepetition(Temp)==0) { cout<<"账户存在"<> id ; strcpy(Temp,Path1); strcat(Temp,id); strcat(Temp,".txt"); if(ScanRepetition(Temp) == -1) { cout<<"没有该运动员的信息,报名取消错误"<> D.year ; cout<> D.month ; cout<> D.day ; cout<> D.hours ; cout<> D.minutes ; cout<> D.second ; cout<> name ; cout<> PW ; if ( strcmp(PW,Password)==0) { int i ; cout<<"验证成功"< D.month) { return true ; } } else if (SD.year == D.year && SD.month == D.month && SD.day != D.day) { if (SD.day  D.day) { return true ; } } else if ( SD.year == D.year && SD.month == D.month && SD.day == D.day && SD.hours !=D.hours) { if (SD.hours  D.hours) { return true ; } } } 


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

以上就是C++实现校园运动会报名系统的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » C语言