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

C++实现校园运动会报名系统,第1张

概述这篇文章主要为大家详细介绍了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

{

system("cls");

cout<<"请输入第 " <

p = (linkList )malloc(sizeof(LNode)) ;

if(p==NulL)

{

cout<<"CreatList fail "<

exit(ERROR) ;

}

cout<<"姓名"<<" " ;

cin>> p->data.name ;

cout<

cout<<"学号"<<" :";

cin >>p->data.IDcard ;

cout<

cout<<"性别"<<" :" ;

cin>> p->data.gender;

cout<

cout<<"年龄"<<" :" ;

cin>> p->data.age ;

cout<

cout<<"学院"<<" :" ;

cin>> p->data.Institute ;

cout<

cout<<"班级"<<" :" ;

cin>> p->data.Class;

cout<

/* strcpy(p->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"<

exit(ERROR) ;

}

p = L ;

int k = 1 ;

while(p)

{

if(k>=i)

break ;

++k;

p = p->next ;

}

if(!p || k>i)

{

cout<<"没找到"<

e.age = UNFOUND ;

e.gender = 'F' ;

strcpy(e.Class,"");

strcpy(e.Institute,"");

strcpy(e.name,"");

}

e = p->data ;

return OK ;

}

Status List::printList(linkList &L )

{

/* 打印线性表 */

linkList p = L ;

while(p)

{

cout<<"姓名 : " <data.name <

cout<<"学号 : " <data.IDcard <

cout<<"性别 : "<data.gender<

cout<<"年龄 : "<data.age<

cout<<"学院 : "<data.Institute<

cout<<"班级 : "<data.Class<

cout<<"报名时间 : "<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<

p = p->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 "<

exit(0);

}

char cpy_Path[MAX] ={''} ;

system("cls");

while(p)

{

//再加一个扫描,看是否有重名 ;

strcpy(cpy_Path,Path1) ;

char T[MAX] ;

strcpy(T,strcat( strcat(cpy_Path,p->data.IDcard),".txt"));

int Judge = ScanRepetition(T) ;// 扫描是否有重名;

if(Judge == 0) // 存在返回0

{

char ch ;

cout<<"你输入的学号已经被录入或者您输入的学号有误,请不要重复录入. "<

remove(T); // *** 作失败文件删除

Go_back2();

}

else

{

strcpy(name,p->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 "<

exit(0) ;

}

fprintf(fin,"%s %s %d %c %s %s %d %d %d %d %d %d n",p->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.hours,

p->data.Join_time.second);

memset(m,'',sizeof(m));

memset(n,sizeof(n));

memset(name,sizeof(name));

memset(cpy_Path,sizeof(cpy_Path)) ;

memset(T,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:dossportSystem"

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,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 &second );

#endif // List_H

Campus.cpp

#include "Campus.h"

#include "List.h"

#include

#define Path2 "D:dosadministrator"

voID ShowPage()

{

cout<

cout<<"ttt ***********************************"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt *t校 园 运 动 会 报 名 系 统 *"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 1 报名系统进入 ☆ *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 2 报名信息查询 ☆ *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 3 运动员信息 ☆ *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 4 退出系统 ☆ *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 0 管理员系统 ☆ *"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt ***********************************"<

MenuChoose();

return ;

}

voID MenuChoose()

{

int num ;

cout<

cout<<"========================================================================"<

cout<<"功能选择"<

if(scanf("%d",&num)) // 正常输入

{

switch (num)

{

case 1:

{

system("cls");// 清屏转换下一级功能;

Show_Apply_System();

}

break ;

case 2:

{

Apply_information_query();

}

break ;

case 3:

{

Athlete_information();

}

break ;

case 0:

{

administrator_System();

}

break ;

case 4:

{

exit(0);

}

default :

{

cout<<"ERORR"<

exit(ERROR);

}

}

}

return ;

}

voID Apply_System()

{

/*报名系统 */

file *fp ;

List a ; // 对象

linkList L ; //

int i,n ;

char ch1,ch2 ;

char ch3 ;

cout<<"个数"<

cin >> n ;

a.CreatList(L,n);

cout<<" 身份信息确认 "<<"[y/n]"<<" ";

cin >>ch1 ;

if(ch1=='y')

{

cout<<" 确认成功 "<

Sleep(1);

}

cout<<" 身份信息查看 "<<"[y/n]"<<" ";

cin >>ch2 ;

if(ch2=='y')

{

a.printList(L);

Sleep(500);

}

Go_back1();

return ;

}

voID Show_Apply_System()

{

int index ;

cout<

cout<<"ttt ***********************************"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt *t 报 名 系 统 *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ◎"<<" 1 学生信息录入 ◎ *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ◎"<<" 2 运动项目报名 ◎ *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ◎"<<" 3 返回上一页 ◎ *"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt ***********************************"<

cout<<"请选择"<

cin >>index ;

if(index == 1)

{

Apply_System();// 录用信息

}

else if(index ==2 )

{

linkList L ;

cout<<"运动项目报名"<

Sport_item_sign();

}

else if( index == 3)

{

system("cls");

ShowPage();

}

else

{

Go_back2();

}

return ;

}

voID Sport_item_sign()

{

// 首先 参看运动会参赛注意事项;

char ch ;

char ih ;

int it1,it2 ;

char ID[MAX] ;

char cpy_path1[MAX] ;

Message M,Stu;

Data d ;

file *fp = fopen("Data.txt","r");

cout<<"注意报名截止时间 : ";

if(!fp)

{

exit(0);

}

fscanf(fp,"%d%d%d%d%d%d",&d.year,&d.month,&d.day,&d.hours,&d.minutes,&d.second);

printf("[ %d -%d -%d %d:%d: %d ]n",d.year,d.month,d.day,d.hours,d.minutes,d.second);

cout<

if(Judge_IF_Past_due() == true )

{

// 时间过期;

cout<<" 报名时间已经截止 ";

Go_back2();

}

else

{

cout<<"输入你的学生证号 : ";

cin >>ID ;

strcpy(cpy_path1,Path1) ;

strcat(cpy_path1,ID);

strcat(cpy_path1,".txt");

if(ScanRepetition(cpy_path1) == -1)

{

cout<<"没有该学生信息"<

Go_back1();

}

if(ScanRepetition(cpy_path1)==0 && Judge_IF_sign(cpy_path1))

{

cout<<"该生已经报名,请勿重复报名"<

Go_back2();

}

file *fIDCARD = fopen(cpy_path1,"a+"); // 添加运动项目

if(!fIDCARD)

{

cout<<"open the file "<

exit(0) ;

}

/*识别性别*/

rewind(fIDCARD);

fscanf(fIDCARD,"%s %s %d %c %s %s %d %d %d %d %d %d ",Stu.IDcard,Stu.name,&Stu.age,&Stu.gender,Stu.Institute,Stu.Class,

&Stu.Join_time.year,&Stu.Join_time.month,&Stu.Join_time.day,&Stu.Join_time.hours,&Stu.Join_time.minutes,&Stu.Join_time.second

);

system("cls");

file *SPORT_IN_file = fopen("SPORT.txt","r");

if(!SPORT_IN_file)

{

cout<<"SPORT_IN_file open ERROR"<

exit(0);

}

ch = fgetc(SPORT_IN_file);

while(!feof(SPORT_IN_file))

{

putchar(ch);

ch = fgetc(SPORT_IN_file);

Sleep(5);

}

fclose(SPORT_IN_file);

system("pause");

system("cls");

cout<

if (Stu.gender == 'm')// 如果是男的

{

Per p[MAX] ;

// num ;

// name ;

char t1[MAX],t2[MAX] ;

file *sport = fopen("sportitemm.txt","r");

if(!sport)

{

cout<<"sportitemm open ERROR"<

exit(0);

}

ih = fgetc(sport);

while(!feof(sport))

{

putchar(ih);

ih = fgetc(sport);

Sleep(10);

}

fclose(sport);

file *fin = fopen("M.txt","r");

cout<

cout<<"选择参加项目"<

cout<<"每名运动员可任意选择两种项目 (选一种的选择000)"<

//cin >> 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,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<<"选择成功"<

printList_new(M);

fclose(fIDCARD);

Sleep(500);

Go_back1();

}

else if (Stu.gender == 'f')

{

Per p[MAX] ;

char t1[MAX],t2[MAX] ;

file *sport = fopen("sportitemF.txt","r");

if(!sport)

{

cout<<"sportitemm open ERROR"<

exit(0);

}

ih = fgetc(sport);

while(!feof(sport))

{

putchar(ih);

ih = fgetc(sport);

Sleep(10);

}

fclose(sport);

file *fin = fopen("F.txt","r");

cout<

cout<<"选择参加项目"<

cout<<"每名运动员可任意选择两种项目 (选一种的选择000)"<

cin >> t1 >> t2 ;

int i = 0 ;

int flag1,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,M.sport_it2);

cout<<"选择成功"<

printList_new(M);

fclose(fIDCARD);

Sleep(500);

Go_back1();

}

}

}

voID Apply_information_query()

{

// 报名信息查询 ;

int i ;

char ID_register[MAX] ;

char Temp[MAX];

system("cls");

cout <<"请输入学号 :"<<" " ;

cin>>ID_register ;

strcpy(Temp,Path1);

strcat(ID_register,".txt");

strcat(Temp,ID_register);

if(ScanRepetition(Temp)== -1 )

{

cout<<"没有该生的相关信息!"<

Go_back1();

}

if(Judge_IF_sign(Temp)== false)

{

cout<<"状态 : 未报名"<

}

else

cout<<"状态 : 已报名"<

Go_back1();

return ;

}

voID Athlete_information()

{

int i ;

char ID_register[MAX] ;

char Temp[MAX];

system("cls");

cout <<"请输入学号 :"<<" " ;

cin>>ID_register ;

strcpy(Temp,ID_register);

if(ScanRepetition(Temp)== -1)

{

cout<<"没有该生的相关信息!"<

Go_back1();

}

if(Judge_IF_sign(Temp))

{

Point_Base_Me(Temp);

Go_back1();

}

else

{

cout<<"还没报名哦,请现在报名才能查看哦 !"<

Go_back1();

}

return ;

}

bool Judge_IF_sign(char *Path)

{

// 判断学生是否已报名项目;

bool flag = false ;

char Temp[MAX] ;

int count = 0;

file *fp = fopen(Path,"r") ;

if(!fp)

{

cout<<"该生没有录入信息"<

exit(0) ;

}

while(!feof(fp))

{

count +=fscanf(fp,"%s",Temp);

}

if (count == 14)// 如果已经报名;

flag = true ;

return flag ;

}

voID Go_back1()

{

char ch ;

cout<<" 返回主页面 "<<" [y/n] ";

cin >>ch ;

if(ch=='y')

{

system("cls");

ShowPage();

}

else

{

cout<<"服务器错误00044xx"<

exit(0);

}

return ;

}

voID Go_back2()

{

char ch ;

cout<<" 返回上一级 "<<" [y/n] ";

cin >>ch ;

if(ch=='y')

{

system("cls");

Show_Apply_System();

}

else

{

cout<<"服务器错误00044xx"<

exit(0);

}

return ;

}

voID Go_back3()

{

// 返回管理系统上一级;

char ch ;

cout<<" 返回上一级 "<<" [y/n] ";

cin >>ch ;

if(ch=='y')

{

system("cls");

show_in_AdSYstem();

}

else

{

cout<<"服务器错误00044xx"<

exit(0);

}

return ;

}

voID Go_back4()

{

char ch ;

cout<<" 返回上一级 "<<" [y/n] ";

cin >>ch ;

if(ch=='y')

{

system("cls");

Manage_system();

}

else

{

cout<<"服务器错误00044xx"<

exit(0);

}

return ;

}

voID printList_new(Message &M)

{

cout<<"姓名 : " <

cout<<"学号 : " <

cout<<"性别 : "<

cout<<"年龄 : "<

cout<<"学院 : "<

cout<<"班级 : "<

cout<<"报名项目 : "<

cout<<"报名时间 : "<

M.Join_time.day <<" "<

return ;

}

voID Point_Base_Me(char *Temp)

{

file *fp = fopen(Temp,"r");

Message M ;

fscanf(fp,M.sport_it2);

printList_new(M);

Go_back1();

return ;

}

voID administrator_System()

{

// 管理员 ;

// 加一个 管理员登录 ;

Enter_Adsystem();

}

voID show_in_AdSYstem()

{

/*

cout<<"您已进入管理员系统"<< endl;

cout<<"请输入管理员账号和密码"<

system("cls");

cout<

cout<<"ttt ***********************************"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt *t 管 理 员 系 统 *"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 1 账号注册 ☆ *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 2 管理系统 ☆ *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 3 返回上一页 ☆ *"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt ***********************************"<

AD_Menu();

return ;

}

voID AD_Menu()

{

int num ;

cout<

cout<<"========================================================================"<

cout<<"功能选择"<

if(scanf("%d",&num)) // 正常输入

{

switch (num)

{

case 1:

{

Log_administrator();

}

break ;

case 2:

{

Manage_system();

}

break ;

case 3:

{

system("cls");

ShowPage();

}

break ;

default :

{

cout<<"ERORR"<

exit(ERROR);

}

}

}

return ;

}

voID Log_administrator()

{

// 账号注册 ;

file *fp ;

AD admin ;

char Pass_word[MAX] ;

char Temp[MAX] ;

strcpy(Temp,Path2);

cout<<"输入姓名"<<" : ";

cin>>admin.num ;

strcat(Temp,admin.num);

strcat(Temp,".txt");

cout<

cout<<"输入密码"<<" : ";

cin>>admin.password ;

cout<

OP: cout<<"重复密码"<<" : ";

cin>>Pass_word ;

if(strcmp(admin.password,Pass_word) == 0 )

{// 密码正确 并且文件不存在

if(ScanRepetition(Temp)==0)

{

cout<<"账户存在"<

exit(ERROR);

}

cout<<"注 册 成 功"<

fp = fopen(Temp,"w");

if(!fp)

{

cout<<"open Temp Failed "<

exit(ERROR) ;

}

fprintf(fp,admin.password);

fclose(fp);

Go_back3();

}

else

{

cout<<"密码不一致"<

goto OP ;

}

return ;

}

voID Manage_system()

{

system("cls");

cout<

cout<<"ttt ***********************************"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt *t 管 理 系 统 *"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 1 运动员报名取消 *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 2 修改截止日期 *"<

cout<<"ttt * *"<

cout<<"ttt *t"<<" ☆"<<" 3 返回上一页 *"<

cout<<"ttt * *"<

cout<<"ttt * *"<

cout<<"ttt ***********************************"<

AD_Menu2();

return ;

}

voID AD_Menu2()

{

int num ;

cout<

cout<<"========================================================================"<

cout<<"功能选择"<

if(scanf("%d",&num)) // 正常输入

{

switch (num)

{

case 1:

{

// 运动员报名取消 删除文件

Cancel_signup();

}

break ;

case 2:

{

// 修改截止日期;

Revise_Data();

Go_back3();

}

break ;

case 3:

{

show_in_AdSYstem();

}

default :

{

cout<<"ERORR"<

exit(ERROR);

}

}

}

return ;

}

voID Cancel_signup()

{

// 报名取消;

// 杀出文件

char ID[MAX] ; //

char Temp[MAX] ;

cout<<" 输入报名取消的运动员学号"<<" :";

cin >> ID ;

strcpy(Temp,Path1);

strcat(Temp,ID);

strcat(Temp,".txt");

if(ScanRepetition(Temp) == -1)

{

cout<<"没有该运动员的信息,报名取消错误"<

exit(0);

}

else

{

remove(Temp);

cout<<"删除成功"<

}

Go_back3();

return ;

}

voID Revise_Data()

{

// 修改日期 ;

file *fp = fopen("Data.txt","w");

Data D ;

cout<< "输入年份"<<" : ";

cin >> D.year ;

cout<

cout<< "输入月份"<<" : ";

cin >> D.month ;

cout<

cout<< "输入天数"<<" : ";

cin >> D.day ;

cout<

cout<< "输入小时"<<" : ";

cin >> D.hours ;

cout<

cout<< "输入分钟"<<" : ";

cin >> D.minutes ;

cout<

cout<< "输入秒数"<<" : ";

cin >> D.second ;

cout<

fprintf(fp,"%d %d %d %d %d %d",D.year,D.month,D.day,D.hours,D.minutes,D.second);

cout<<"修改成功"<

fclose(fp);

return ;

}

voID Enter_Adsystem()

{

char name[MAX] ;

char Temp[MAX] ;

char Password[MAX] ;

char PW[MAX] ;

file *fp ;

cout <<" 请输入管理员账号名 : ";

cin >> name ;

cout<

strcpy(Temp,Path2) ;

strcat(Temp,name) ;

strcat(Temp,".txt");

if(ScanRepetition(Temp) == -1)

{

// 不存在

cout<<" 管理员账号不存在 "<

exit(0) ;

}

fp = fopen(Temp,"r") ;

if(!fp)

{

cout<<" open the file Failed "<

exit(0) ;

}

fscanf(fp,Password);

fclose(fp) ;

cout <<" 你输入密码验证 "<<" : ";

cin >> PW ;

if ( strcmp(PW,Password)==0)

{

int i ;

cout<<"验证成功"<

for(i = 1 ; i<= 4 ; i++)

{

cout <

Sleep(500) ;

system("cls");

}

show_in_AdSYstem();

}

else

{

cout <<"验证失败"<

Go_back1();

}

return ;

}

bool Judge_IF_Past_due()

{

Message M ;

Data D ; // 截止时间

Data SD ; // 当前时间 ;

// bool C = true ; // 初始值时过期了

file *Dp = fopen("Data.txt","r");

if(!Dp)

{

exit(0);

}

fscanf(Dp,&D.year,&D.month,&D.day,&D.hours,&D.minutes,&D.second);

//printf("截止时间 :%d -%d- %d %d :%d :%d n",D.second);

Gettime_f(SD.year,SD.month,SD.day,SD.hours,SD.minutes,SD.second); //获取当前时间

printf("当前时间 : [ %d -%d- %d %d :%d :%d ]n",SD.year,SD.second);

if( SD.year < D.year )

{

// 截止时间 :2019 -5- 47 8 :63 :12

// 当前时间 :2018 -7- 11 15 :46 :24

return false ; // 还没截止

}

else if (SD.year == D.year && SD.month != D.month)

{

if(SD.month < D.month)

{

return false ;

}

else if ( SD.month > D.month)

{

return true ;

}

}

else if (SD.year == D.year && SD.month == D.month && SD.day != D.day)

{

if (SD.day

{

// 如果当前天数 小于 截止天数

return false ;

}

else 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

{

return false ;

}

else if ( SD.hours > D.hours)

{

return true ;

}

}

}

代码有点多,应该还能改进,路径可以自己改。


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

总结

以上是内存溢出为你收集整理的C++实现校园运动会报名系统全部内容,希望文章能够帮你解决C++实现校园运动会报名系统所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1264802.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)

保存