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

2020-01-06 19:41:23王冬梅

List.h


#ifndef LIST_H
#define LIST_H
#include <iostream>
#include <cstdlib>
#include <direct.h>
#include <time.h>
#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,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 <windows.h>
#define Path2 "D:dosAdministrator"
void ShowPage()
{
 cout<<endl<<endl;
  cout<<"ttt  ***********************************"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t校 园 运 动 会 报 名 系 统  *"<<endl ;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 1 报名系统进入  ☆  *"<<endl;
 cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 2 报名信息查询  ☆  *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 3 运动员信息   ☆  *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 4 退出系统    ☆  *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 0 管理员系统   ☆  *"<<endl;
 
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  ***********************************"<<endl;
  MenuChoose();
  return ;
}
void MenuChoose()
{
  int num ;
  cout<<endl;
  cout<<"========================================================================"<<endl;
  cout<<"功能选择"<<endl;
  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"<<endl;
          exit(ERROR);
        }
    }
 
  }
 
  return ;
}
void Apply_System()
{
 /*报名系统 */
 FILE *fp ;
 List a ; // 对象
 LinkList L ; //
 int i ,n ;
 char ch1,ch2 ;
 char ch3 ;
 cout<<"个数"<<endl;
 cin >> n ;
 a.CreatList(L,n);
 cout<<" 身份信息确认 "<<"[y/n]"<<" ";
 cin >>ch1 ;
 if(ch1=='y')
 {
 cout<<" 确认成功 "<<endl;
 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<<endl<<endl<<endl;
  cout<<"ttt  ***********************************"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t   报 名 系 统      *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ◎"<<" 1 学生信息录入   ◎  *"<<endl;
 cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ◎"<<" 2 运动项目报名   ◎  *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ◎"<<" 3 返回上一页    ◎  *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  ***********************************"<<endl;
 cout<<"请选择"<<endl;
 cin >>index ;
 if(index == 1)
 {
 Apply_System();// 录用信息
 }
 else if(index ==2 )
 {
 LinkList L ;
 cout<<"运动项目报名"<<endl;
 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<<endl;
 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<<"没有该学生信息"<<endl;
  Go_back1();
 }
 
 if(ScanRepetition(Cpy_path1)==0 && Judge_IF_sign(Cpy_path1))
 {
  cout<<"该生已经报名,请勿重复报名"<<endl;
  Go_back2();
 }
 FILE *fIDCARD = fopen(Cpy_path1 ,"a+"); // 添加运动项目
 if(!fIDCARD)
 {
  cout<<"open the file "<<endl;
  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"<<endl;
  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<<endl <<endl ;
 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"<<endl;
  exit(0);
 }
 ih = fgetc(sport);
 while(!feof(sport))
 {
  putchar(ih);
  ih = fgetc(sport);
  Sleep(10);
 }
 fclose(sport);
 FILE *fin = fopen("M.txt","r");
 
 cout<<endl;
 cout<<"选择参加项目"<<endl;
 cout<<"每名运动员可任意选择两种项目 (选一种的选择000)"<<endl;
 //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,"%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<<"选择成功"<<endl;
 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"<<endl;
  exit(0);
 }
 ih = fgetc(sport);
 while(!feof(sport))
 {
  putchar(ih);
  ih = fgetc(sport);
  Sleep(10);
 }
 fclose(sport);
 FILE *fin = fopen("F.txt","r");
 
 cout<<endl;
 cout<<"选择参加项目"<<endl;
 cout<<"每名运动员可任意选择两种项目 (选一种的选择000)"<<endl;
 
 cin >> 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<<"选择成功"<<endl;
 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<<"没有该生的相关信息!"<<endl;
 Go_back1();
 }
 if(Judge_IF_sign(Temp)== false)
 {
 cout<<"状态 : 未报名"<<endl;
 }
 else
 cout<<"状态 : 已报名"<<endl;
 
 Go_back1();
  return ;
}
void Athlete_Information()
{
 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<<"没有该生的相关信息!"<<endl;
 Go_back1();
 }
 if(Judge_IF_sign(Temp))
 {
 Point_Base_Me(Temp);
 Go_back1();
 }
 else
 {
 cout<<"还没报名哦 ,请现在报名才能查看哦 !"<<endl;
 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<<"该生没有录入信息"<<endl;
 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"<<endl;
 exit(0);
 }
 return ;
}
void Go_back2()
{
 char ch ;
 cout<<" 返回上一级  "<<" [y/n] ";
 cin >>ch ;
 if(ch=='y')
 {
 system("cls");
 Show_Apply_System();
 }
 else
 {
 cout<<"服务器错误00044xx"<<endl;
 exit(0);
 }
 return ;
 
 
}
void Go_back3()
{
 
 // 返回管理系统上一级;
 char ch ;
 cout<<" 返回上一级  "<<" [y/n] ";
 cin >>ch ;
 if(ch=='y')
 {
 system("cls");
 show_in_AdSYstem();
 }
 else
 {
 cout<<"服务器错误00044xx"<<endl;
 exit(0);
 }
 
 
 return ;
}
void Go_back4()
{
 char ch ;
 cout<<" 返回上一级  "<<" [y/n] ";
 cin >>ch ;
 if(ch=='y')
 {
 system("cls");
 Manage_system();
 }
 else
 {
 cout<<"服务器错误00044xx"<<endl;
 exit(0);
 }
 return ;
}
void printList_new(Message &M)
{
 
 cout<<"姓名 : " <<M.name <<endl;
 cout<<"学号 : " <<M.IDcard <<endl;
 cout<<"性别 : "<<M.gender<<endl;
 cout<<"年龄 : "<<M.age<<endl;
 cout<<"学院 : "<<M.Institute<<endl;
 cout<<"班级 : "<<M.Class<<endl;
 cout<<"报名项目 : "<<M.sport_it1 <<" "<<M.sport_it2 <<endl;
 cout<<"报名时间 : "<<M.Join_time.year<<"-"<<M.Join_time.month<<"-"<<
 M.Join_time.day <<" "<<M.Join_time.hours<<":"<<M.Join_time.minutes<<":"<<M.Join_time.second<<endl;
 
 return ;
}
void Point_Base_Me(char *Temp)
{
 FILE *fp = fopen(Temp,"r");
 Message M ;
 
 fscanf(fp,"%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);
 printList_new(M);
 Go_back1();
 return ;
}
void Administrator_System()
{
 // 管理员 ;
 // 加一个 管理员登录 ;
 Enter_Adsystem();
 
}
void show_in_AdSYstem()
{
 /*
 cout<<"您已进入管理员系统"<< endl;
 cout<<"请输入管理员账号和密码"<<endl;*/
 system("cls");
 cout<<endl<<endl;
  cout<<"ttt  ***********************************"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t  管 理 员 系 统      *"<<endl ;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 1 账号注册    ☆   *"<<endl;
 cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 2 管理系统    ☆   *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 3 返回上一页   ☆   *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  ***********************************"<<endl;
 AD_Menu();
 return ;
}
void AD_Menu()
{
 
  int num ;
  cout<<endl;
  cout<<"========================================================================"<<endl;
  cout<<"功能选择"<<endl;
  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"<<endl;
          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<<endl;
 cout<<"输入密码"<<" : ";
 cin>>admin.password ;
 cout<<endl;
OP: cout<<"重复密码"<<" : ";
 cin>>Pass_word ;
 
 if(strcmp(admin.password,Pass_word) == 0 )
 {// 密码正确 并且文件不存在
 if(ScanRepetition(Temp)==0)
 {
  cout<<"账户存在"<<endl;
  exit(ERROR);
 }
 cout<<"注 册 成 功"<<endl;
 fp = fopen(Temp,"w");
 if(!fp)
 {
  cout<<"open Temp failed "<<endl;
  exit(ERROR) ;
 }
 fprintf(fp,"%s",admin.password);
 
 fclose(fp);
 Go_back3();
 }
 else
 {
 cout<<"密码不一致"<<endl;
 
 goto OP ;
 }
 
 return ;
}
void Manage_system()
{
 system("cls");
 cout<<endl<<endl;
  cout<<"ttt  ***********************************"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t  管 理 系 统       *"<<endl ;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 1 运动员报名取消    *"<<endl;
 cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 2 修改截止日期     *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *t"<<" ☆"<<" 3 返回上一页      *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  *                 *"<<endl;
  cout<<"ttt  ***********************************"<<endl;
 AD_Menu2();
 
 return ;
}
void AD_Menu2()
{
 int num ;
  cout<<endl;
  cout<<"========================================================================"<<endl;
  cout<<"功能选择"<<endl;
  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"<<endl;
          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<<"没有该运动员的信息,报名取消错误"<<endl;
 exit(0);
 
 }
 else
 {
 remove(Temp);
 cout<<"删除成功"<<endl;
 
 }
 Go_back3();
 return ;
 
}
void Revise_Data()
{
 // 修改日期 ;
 FILE *fp = fopen("Data.txt","w");
 Data D ;
 cout<< "输入年份"<<"  : ";
 cin >> D.year ;
 cout<<endl;
 cout<< "输入月份"<<"  : ";
 cin >> D.month ;
 cout<<endl;
 cout<< "输入天数"<<"  : ";
 cin >> D.day ;
 cout<<endl;
 cout<< "输入小时"<<"  : ";
 cin >> D.hours ;
 cout<<endl;
 cout<< "输入分钟"<<"  : ";
 cin >> D.minutes ;
 cout<<endl;
 cout<< "输入秒数"<<"  : ";
 cin >> D.second ;
 cout<<endl;
 fprintf(fp,"%d %d %d %d %d %d",D.year,D.month,D.day ,D.hours ,D.minutes ,D.second);
 cout<<"修改成功"<<endl;
 fclose(fp);
 return ;
}
void Enter_Adsystem()
{
 char name[MAX] ;
 char Temp[MAX] ;
 char Password[MAX] ;
 char PW[MAX] ;
 FILE *fp ;
 cout <<" 请输入管理员账号名 :  ";
 cin >> name ;
 cout<<endl;
 strcpy(Temp , Path2) ;
 strcat(Temp , name) ;
 strcat(Temp , ".txt");
 if(ScanRepetition(Temp) == -1)
 {
 // 不存在
 cout<<" 管理员账号不存在 "<<endl ;
 exit(0) ;
 }
 fp = fopen(Temp , "r") ;
 if(!fp)
 {
 cout<<" open the file failed "<<endl;
 exit(0) ;
 }
 fscanf(fp , "%s",Password);
 fclose(fp) ;
 cout <<" 你输入密码验证 "<<" : ";
 cin >> PW ;
 if ( strcmp(PW,Password)==0)
 {
 int i ;
    cout<<"验证成功"<<endl ;
    
 for(i = 1 ; i<= 4 ; i++)
 {
  cout <<i;
  Sleep(500) ;
  system("cls");
 
 }
    show_in_AdSYstem();
 }
 else
 {
 cout <<"验证失败"<<endl;
 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%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);
 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.month ,SD.day ,SD.hours ,SD.minutes ,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 <D.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 <D.hours )
 {
 
  return false ;
 }
 else if ( SD.hours > D.hours)
 {
  return true ;
 }
 
 }
 
 
}