C++课程设计——课程表与信息管理系统
关于C++的课程设计,这里分享一个我的课题
直接上代码
#ifndef STUDY_H_INCLUDED #define STUDY_H_INCLUDED #include #include #include #include #include <windows.h> using namespace std;
struct Nodel //枚举坐标操纵 { int x; int y; }; void gotoxy(Nodel p); //获取枚举坐标 void qingping(); //清屏函数 void shijian(); //时间函数 bool back(); //{ // COORD q; // q.X=p.x; // q.Y=p.y; // HANDLE hOut; // hOut= GetStdHandle(STD_OUTPUT_HANDLE); // SetConsoleCursorPosition(hOut,q); //} extern Nodel pt; //从别处引用该结构体
class Course //课程类 { private: int WhatNum; public: Course(){WhatNum=0;}; //析构函数 struct Node //定义课程的结构体 { int Coursenum; //课程编号 char Coursename[20]; //课程名称 int period; //课程周期 char term[50]; //学期 int myself; // int mm; char teacher[20]; //授课教师 int ClassNum; //上课教室 friend bool operator<(Node a,Node b) { return a.mm>b.mm; //返回mm值大的课程结构体 } }; vectoredge[100]; //创建int型向量edge,长度为100,边缘范围; Node course[100]; //创建Node结构体course,100个; int indegree[100]; //声明长度为100的数组 void ChangeWhatNum(int n){WhatNum=n;return ;}; //修改WhatNum int GetWhatNum(){return WhatNum;}; };
class Assgement:public Course //日程安排类 { public : int Is_class[6][6]; //声明一个二维数组 Node kuopu[100]; //声明一个kuopu一维数组 (键盘可操作范围) int xueqi[10]; int XingQi[10]; //星期 char things[50]; Assgement(){ChangeWhatNum(0);}; int document();//创建文件,访问内容 void init(); void kuopupaixv();//扩谱排序 void show();//展示课表 void chakan();//查看课程 void addcourse();//添加课程 void Delcourse();//修改课程 void specialclass();//特殊课程提醒 void Classbecome(); //课程开始函数 //要添加到提醒中去 void Alert(); void jishi(); void chaxun(); };
#endif // STUDY_H_INCLUDED //结束编译
#ifndef STUDENT_H_INCLUDED //开始定义,便于管理 #define STUDENT_H_INCLUDED #include #include #include "study1.h" using namespace std;
class student:public Assgement { public: struct People //编辑学生(老师)的结构体 { char Name[20]; char Xuehao[20]; char PassWord[20]; char jiaoyan[20]; }; int flag; //标记是否登录 student(){flag=0;}; //构造函数 People stu; //实例化人的结构体(学生) void wenjian(); //建立文件流 bool inlogo(); //用户登陆 void overinlogo(); //登录 void zhuce(); //用户注册 void Beimformaton(); //个人信息 void liebiao(); //列表 void kebiao(); //每周课表 void kebiao_shengcheng(); //课表生成 void zhuyemian(); //主页面 void caozuo(int x,int y); //操作移动 void xuanze(int x,int y); void tixing();
}; #endif // STUDENT_H_INCLUDED //结束本类编辑
#include #include #include #include #include #include <conio.h> #include #include <windows.h> #include "study1.h" #include "student1.h" using namespace std;
//////////////////////////光标控制////////////////// //struct Nodel //{ // int x,y; //}; //void gotoxy(Nodel p) //{ // COORD q; // q.X=p.x; // q.Y=p.y; // HANDLE hOut; // hOut= GetStdHandle(STD_OUTPUT_HANDLE); //掌控屏幕操作控制 // SetConsoleCursorPosition(hOut,q); //} Nodel pt; //使用枚举结构体(全局) /////////////////////////////////////////////////
void student::wenjian() { freopen("student_masseage.in","w",stdout); //文件打开student—masseage FILE *pf; //声明文件型指针 if((pf=fopen("informatiom.txt","r+"))==NULL) //判断打开文件内容 { cout<<"系统错误!"<<endl; } else {
char ch[300]; //声明char形式数组,长度100
// fgets(ch,260,pf); // printf("%s\n",ch); while(!feof(pf)) //文件尾部检测 { fgets(ch,260,pf); //文件顺序读取 cout<<ch<<"\n"<<endl; //显示内容 } } freopen("CON", "w", stdout); fclose(pf); return ; }
bool student::inlogo() { wenjian(); char Xuehao[20]; char PassWord[20]; pt.x=60,pt.y=7; //坐标位置 gotoxy(pt); cout<<"请输入学号:"; cin>>Xuehao; getchar(); //获取字符串 pt.x=60,pt.y=8; gotoxy(pt); cout<<"请输入密码:"; cin>>PassWord; getchar(); freopen("student_masseage.in","r",stdin); //读文件 while(scanf("%s %s %s",stu.Name,stu.Xuehao,stu.PassWord)!=EOF) { if(strcmp(stu.Xuehao,Xuehao)==0) //比对函数 { if(strcmp(stu.PassWord,PassWord)==0) { pt.x=60,pt.y=9; gotoxy(pt); cout<<"登陆成功\n"; qingping(); } else { pt.x=60,pt.y=9; gotoxy(pt); cout<<"密码错误\n"; return false; }
}
}
pt.x=60,pt.y=9;
gotoxy(pt);
printf("没有此账号,请重新注册!\n");
fclose(stdin);
freopen("CON", "r", stdin);
return false;
}
void student::overinlogo() { if(inlogo()) { //生成课表,标记为1flag=1. init(); kuopupaixv(); flag=1; }
}
void student::zhuce() { FILE *pf; //声明文件指针 if((pf=fopen("informatiom.txt","at+"))==NULL) //判断打开文件内容 { pt.x=60,pt.y=7; gotoxy(pt); cout<<"系统错误\n"; return ; } pt.x=60,pt.y=7; gotoxy(pt); cout<<"请输入姓名:"; cin>>stu.Name; pt.x=60,pt.y=8; gotoxy(pt); cout<<"请输入学号:"; cin>>stu.Xuehao; loop: pt.x=60,pt.y=9; gotoxy(pt); cout<<"请设计密码:"; cin>>stu.PassWord; pt.x = 60, pt.y = 10; gotoxy(pt); cout << "再次输入:"; cin >> stu.jiaoyan; fprintf(pf,"%s %s %s %s\n",stu.Name,stu.Xuehao,stu.PassWord,stu.jiaoyan); if (strcmp(stu.PassWord,stu.jiaoyan)==0) { pt.x = 60, pt.y = 11; gotoxy(pt); cout << "注册成功,跳转自动登陆......\n"; Sleep(3000); qingping(); pt.x = 60, pt.y = 12; gotoxy(pt); cout << "登陆成功!\n"; fclose(pf); wenjian(); } else { qingping(); pt.x = 60, pt.y = 11; gotoxy(pt); cout << "密码不正确,请重新再来\n"; liebiao(); pt.x = 60, pt.y = 7; gotoxy(pt); cout << "请输入姓名:"<< stu.Name; pt.x = 60, pt.y = 8; gotoxy(pt); cout << "请输入学号:"<<stu.Xuehao; goto loop; } return ; }
void student::Beimformaton() { pt.x=68,pt.y=7; gotoxy(pt); printf("姓名:%s\n",stu.Name); pt.x=68,pt.y=8; gotoxy(pt); printf("学号:%s\n",stu.Xuehao); // time_t t = time(0); //显示实际时间 // char tmp[64]; // strftime( tmp, sizeof(tmp), "%Y/%m\n",localtime(&t) ); // printf("%s %s\n",tmp,ch); // int year=(tmp[0]-ch[0])*1000+(tmp[1]-ch[1])*100+(tmp[2]-ch[2])*10+(tmp[3]-ch[3]); // int mom=(tmp[5]-ch[5])10+(tmp[6]-ch[6]); // int y=year12+mom; // int n_xueqi=y/5; // printf("%d %d %d\n",year,mom,n_xueqi); // puts(tmp); }
void student::tixing() { int i; pt.x=60,pt.y=3; gotoxy(pt); cout<<"您想要干什么呢: \n"; pt.x=60,pt.y=4; gotoxy(pt); cout<<" 1.定时提醒 \n"; pt.x=60,pt.y=5; gotoxy(pt); cout << " 2.记事 \n"; pt.x=60,pt.y=6; gotoxy(pt); cout << " 3.查询 \n"; pt.x = 60, pt.y = 7; gotoxy(pt); cout << " 4.特殊课程提醒 \n"; pt.x=60,pt.y=8; gotoxy(pt); cout << " 5.返回 \n"; pt.x=60,pt.y=10; gotoxy(pt); cin>>i; if(i==1) { qingping(); liebiao(); Alert(); } if(i==2) { qingping(); liebiao(); jishi(); } if(i==3) { qingping(); liebiao(); chaxun(); } if (i == 4) { qingping(); liebiao(); specialclass(); } if (i == 5) { qingping(); liebiao(); }
}
void student::liebiao() { pt.x=2,pt.y=2; gotoxy(pt); cout<<"┌****************┐\n"; pt.x=2,pt.y=3; gotoxy(pt); cout<<"│ 登录 │\n";
pt.x=2,pt.y=5;
gotoxy(pt);
cout<<"│ 注册 │\n";
pt.x=2,pt.y=7;
gotoxy(pt);
cout<<"│ 四年课程安排 │\n";
pt.x=2,pt.y=9;
gotoxy(pt);
cout<<"│ 查看学期课程 │\n";
pt.x=2,pt.y=11;
gotoxy(pt);
cout<<"│ 增加课程 │\n";
pt.x=2,pt.y=13;
gotoxy(pt);
cout<<"│ 删除课程 │\n";
pt.x=2,pt.y=15;
gotoxy(pt);
cout<<"│ 学期课表 │\n";
pt.x=2,pt.y=17;
gotoxy(pt);
cout<<"│ 学生信息 │\n";
pt.x=2,pt.y=19;
gotoxy(pt);
cout<<"│ 提醒与其他 │\n";
}
void student::kebiao() { // cout<<"\n\n\n\n"; pt.x=22,pt.y=3; gotoxy(pt); printf(" 本周课表\n");
pt.x=22,pt.y=5;
gotoxy(pt);
printf(" | │ 周一 │ 周二 │ 周三 │ 周四 │ 周五 \n");
pt.x=22,pt.y=7;
gotoxy(pt);
printf(" |1 2│ │ │ │ │ \n");
pt.x=22,pt.y=9;
gotoxy(pt);
printf(" |3 4│ │ │ │ │ \n");
pt.x=22,pt.y=11;
gotoxy(pt);
printf(" |5 6│ │ │ │ │ \n");
pt.x=22,pt.y=13;
gotoxy(pt);
printf(" |7 8│ │ │ │ │ \n");
pt.x=22,pt.y=15;
gotoxy(pt);
printf(" |晚修│ │ │ │ │ \n");
pt.x=22,pt.y=17;
gotoxy(pt);
printf(" |晚修│ │ │ │ │ \n");
return ;
}
void student::kebiao_shengcheng() { char ch[50]; time_t t = time(0); char tmp[64]; strftime( tmp, sizeof(tmp), "%Y/%m\n",localtime(&t) ); //截取时间,并修正时间格式 // printf("%s %s\n",tmp,ch); int year=(tmp[0]-ch[0])*1000+(tmp[1]-ch[1])*100+(tmp[2]-ch[2])*10+(tmp[3]-ch[3]); int mom=(tmp[5]-ch[5])10+(tmp[6]-ch[6]); int y=year12+mom; int n_xueqi=y/5; memset(Is_class,0,sizeof(Is_class)); //修改编码,便于清空 int num[20]; int ans=0,co=0; int m=GetWhatNum(); //课程周期 for(int i=1; i<=m; ++i) if(course[i].period==n_xueqi) { num[ans++]=course[i].Coursenum; co+=course[i].mm; } int zhoushu=co/15; //周数 int k; for(int i=0;i<zhoushu;++i) { int x,y; k=i%ans; x=num[k]%4+1; y=(num[k]*ans)%5+1; if(Is_class[x][y]==0) { Is_class[x][y]=num[k]; } else { while(1) { int xx,yy; x++; xx=x%4+1; yy=y%5+1; if(Is_class[xx][yy]==0) { Is_class[xx][yy]=num[k]; break; } } } } for(int i=1;i<=4;++i) { for(int j=1;j<=5;++j) { if(Is_class[i][j]>0) { pt.x=50+(j-1)*18; pt.y=7+(i-1)*2; gotoxy(pt); printf("%s\n",course[Is_class[i][j]].Coursename); //显示课程二维数组 } // printf("\n"); } }
}
void student::zhuyemian() //主页面设计 { liebiao(); if(flag==0) kebiao(); //未登录只显示课表框架 else if(flag==1) { //登陆后课表导入 kebiao(); kebiao_shengcheng();
}
pt.y=27,pt.x=35;
gotoxy(pt);
shijian();
}
void student::caozuo(int x,int y) { pt.x=x,pt.y=y; gotoxy(pt); }
void student::xuanze(int x,int y) { pt.x=x,pt.y=y; gotoxy(pt); if(2<pt.x&&pt.x<18&&y==3) { qingping(); liebiao(); overinlogo(); pt.x=104; pt.y=20; gotoxy(pt); char c; cout<<"按任意键继续...."; c=getch(); // zhuyemian(); } else if(2<pt.x&&pt.x<18&&y==5) {
qingping();
liebiao();
zhuce();
pt.x=104;
pt.y=20;
gotoxy(pt);
char c;
cout<<"按任意键继续....";
c=getch();
}
else if(2<pt.x&&pt.x<18&&y==7)
{
qingping();
liebiao();
show();
pt.x=32;
pt.y=20;
gotoxy(pt);
char c;
cout<<"按任意键继续....";
c=getch();
}
else if(2<pt.x&&pt.x<18&&y==9)
{
qingping();
liebiao();
chakan();
pt.x=104;
pt.y=20;
gotoxy(pt);
char c;
cout<<"按任意键继续....";
c=getch();
}
else if(2<pt.x&&pt.x<18&&y==11)
{
qingping();
liebiao();
addcourse();
pt.x=104;
pt.y=20;
gotoxy(pt);
char c;
cout<<"按任意键继续....";
c=getch();
}
else if(2<pt.x&&pt.x<18&&y==13)
{
qingping();
liebiao();
Delcourse();
pt.x=104;
pt.y=20;
gotoxy(pt);
char c;
cout<<"按任意键继续....";
c=getch();
}
else if(2<pt.x&&pt.x<18&&y==15)
{
qingping();
liebiao();
kebiao();
Classbecome();
pt.x=104;
pt.y=20;
gotoxy(pt);
char c;
cout<<"按任意键继续....";
c=getch();
// system("pause");
// qingping2();
}
else if(2<pt.x&&pt.x<18&&y==17)
{
qingping();
liebiao();
Beimformaton();
pt.x=104;
pt.y=20;
gotoxy(pt);
char c;
cout<<"按任意键继续....";
c=getch();
}
else if(2<pt.x&&pt.x<18&&y==19)
{
qingping();
liebiao();
tixing();
pt.x=104;
pt.y=20;
gotoxy(pt);
pt.x = 104;
pt.y = 20;
gotoxy(pt);
}
}
#include #include #include <process.h> #include #include #include #include <windows.h> #include <conio.h> #include "study1.h" #include "student1.h"
using namespace std; student ke;
int main() { ke.zhuyemian(); int x=0,y=0; ke.caozuo(x,y); char ch; while(1) { // fflush(stdin); ch=getch(); if(ch=='\r') { ke.xuanze(x,y); qingping(); ke.zhuyemian(); } switch(ch) { case 'w': y-=1; break; case 's': y+=1; break; case 'a': x-=2; break; case 'd': x+=2; break; default : break; } ke.caozuo(x,y); } return 0; }
#include #include #include #include #include #include #include #include #include #include <windows.h> #include <mmsystem.h> #include #pragma comment(lib,"winmm.lib") #include "study1.h" #include <conio.h> #include #include <stdlib.h> using namespace std;
void gotoxy(Nodel p) //坐标函数 { COORD q; q.X=p.x; q.Y=p.y; HANDLE hOut; hOut= GetStdHandle(STD_OUTPUT_HANDLE); //获取屏幕坐标控制 SetConsoleCursorPosition(hOut,q); } //nodel pt
void qingping() //清屏函数 {
pt.x=0,pt.y=0;
gotoxy(pt);
for(int i=0;i<50;++i)
{
// for(int j=0;j<150;++j) // { // pt.x=i,pt.y=j; // gotoxy(pt); printf(" "); // } cout<<"\n"; } return ; }
void shijian() //日期函数 { time_t k = time(0); char tp[64]; strftime( tp, sizeof(tp), "\t\t\t\t\t\t\t\t\t\t\t\t时间:%Y/%m/%d",localtime(&k) );//显示当前时间 puts(tp); }
bool back() { if (getch() == 27) { qingping(); return true; } else return false; }
int Assgement::document() { int b=0; // int num; // char name[100]; // int prion; // char cose[100]; // int keshi; FILE *pf; freopen("kechengshuju.txt","w",stdout); if((pf=fopen("shujushuru.txt","r"))==NULL) { cout<<"系统错误\n"; } else { char ch[200];
while(!feof(pf))
{
fgets(ch,190,pf);
printf("%s\n",ch);
b++;
}
}
fclose(pf);
freopen("CON", "w", stdout);
return b-1;
}
void Assgement::init() { int k=document(); ChangeWhatNum(k); memset(indegree,0,sizeof(indegree)); freopen("kechengshuju.txt","r",stdin); int i=1; char ch[50]; while(scanf("%d %s %d %s %d",&course[i].Coursenum,course[i].Coursename,&course[i].period,course[i].term,&course[i].mm)!=EOF) { course[i].myself=i; course[i].mm/=2; // printf("%d %s %d %s\n",course[i].Coursenum,course[i].Coursename,course[i].period,course[i].term); strcpy(ch,course[i].term); for(int j=0;ch[j];++j) { int m; if(ch[j]==',') continue; ++j; m=(ch[j-1]-'0')*10+ch[j]-'0'; if(m==0) continue; edge[m].push_back(i); indegree[i]++; } i++; } fclose(stdin); freopen("CON", "r", stdin); // for(int i=1;i<=38;++i) // printf("%d\n",indegree[i]); return ; }
void Assgement::kuopupaixv() //给课表排序 { queueQ; //队列 int n=GetWhatNum(); xueqi[1]=4,xueqi[2]=6,xueqi[3]=2,xueqi[4]=5,xueqi[5]=4,xueqi[6]=4,xueqi[7]=4,xueqi[8]=0; // XQ[1]=6,XQ[2]=7,XQ[3]=3,XQ[4]=6,XQ[5]=5,XQ[6]=5,XQ[7]=5,XQ[8]=1; for(int i=1;i<=n;++i) { if(course[i].period==0&&indegree[i]==0) { Q.push(i); } } int k=1; int l=1; while(!Q.empty()) { int p=Q.front(); Q.pop(); kuopu[l++]=course[p]; xueqi[k]--; course[p].period=k; if(xueqi[k]==0) k++; int m=edge[p].size(); for(int i=0;i<m;++i) { int to=edge[p][i]; indegree[to]--; if(indegree[to]==0) Q.push(to); } } }
void Assgement::show() { if (back()) return; else { pt.x = 34, pt.y = 2; gotoxy(pt); cout << setw(30) << "课程" << setw(30) << "学期" << setw(30) << "课时"; int n = GetWhatNum(); pt.x = 34, pt.y = 3; gotoxy(pt); // sort(kuopu+1,kuopu+n+1,comp); for (int i = 1; i <= 3; ++i) { for (int j = 1; j <= n; ++j) { if (course[j].period == i) {
int k = strlen(course[j].Coursename);
if (k < 8)
cout << left << setw(30) << course[j].Coursename << left << setw(30) << course[j].period << left << setw(30) << course[j].mm << "\n";
else if (k >= 16)
cout << left << setw(30) << course[j].Coursename << left << setw(30) << course[j].period << left << setw(30) << course[j].mm << "\n";
else
cout << setw(30) << left << course[j].Coursename << setw(30) << left << course[j].period << setw(30) << left << course[j].mm << "\n";
pt.y++;
gotoxy(pt);
}
}
}
pt.x = 80, pt.y = 3;
gotoxy(pt);
for (int i = 4; i <= 8; ++i)
{
for (int j = 1; j <= n; ++j)
{
if (course[j].period == i)
{
int k = strlen(course[j].Coursename);
if (k < 8)
cout << "\t" << course[j].Coursename << "\t\t" << course[j].period << "\t" << course[j].mm << "\n";
else if (k >= 16)
cout << "\t" << course[j].Coursename << "\t\t" << course[j].period << "\t" << course[j].mm << "\n";
else
cout << "\t" << course[j].Coursename << "\t\t" << course[j].period << "\t" << course[j].mm << "\n";
pt.y++;
gotoxy(pt);
}
}
}
return;
}
}
void Assgement::chakan() { if (back()) return; else { pt.x = 34, pt.y = 3; gotoxy(pt); int n; cout << "请输入要查看的学期:"; cin >> n; int m = GetWhatNum(); pt.x = 34, pt.y = 4; gotoxy(pt); cout << "\t课程\t\t\t学期\t课时\t任课教师\t上课教室"; pt.x = 34, pt.y = 5; gotoxy(pt); for (int i = 1; i <= m; ++i) {
for (int j = 1; j <= n; ++j)
{
if (course[i].period == n)
{
cout << "\t" << course[j].Coursename << "\t\t" << course[j].period << "\t" << course[j].mm << "\t" << course[j].teacher << "\t\t" << course[j].ClassNum << "\n";
pt.y++;
gotoxy(pt);
}
}
}
return;
}
}
void Assgement::addcourse() { if (back()) return; else { FILE *pf; if ((pf = fopen("kechengshuju.txt", "at+")) == NULL) { pt.x = 60, pt.y = 7; gotoxy(pt); cout << "系统错误\n"; return; } int n = GetWhatNum() + 1; ChangeWhatNum(n); course[n].Coursenum = n; pt.x = 34, pt.y = 3; gotoxy(pt); cout << "请输入要增加的课程名:"; cin >> course[n].Coursename; pt.x = 34, pt.y = 4; gotoxy(pt); cout << "请输入安排的学期:"; cin >> course[n].period; course[n].myself = n; strcpy(course[n].term, "00"); pt.x = 34, pt.y = 5; gotoxy(pt); cout << "请输入课时数:"; cin >> course[n].mm; // course[n].mm/=2; pt.x = 34, pt.y = 6; gotoxy(pt); cout << "请输入任课老师:"; cin >> course[n].teacher; pt.x = 34, pt.y = 7; gotoxy(pt); cout << "请输入教室号:"; cin >> course[n].ClassNum; fprintf(pf, "%s %d %d %s %d\n", course[n].Coursename, course[n].period, course[n].mm, course[n].teacher, course[n].ClassNum); pt.x = 34, pt.y = 8; gotoxy(pt); cout << "添加成功\n"; return; } }
void Assgement::Delcourse() { if (back()) return; else { int flag = 0; pt.x = 34, pt.y = 3; gotoxy(pt); char sh[50]; cout << "请输入要删除的课程名:"; cin >> sh; int m = GetWhatNum(); int k; for (k = 1; k <= m; ++k) { if (strcmp(sh, course[k].Coursename) == 0) { flag = 1; break; } } if (!flag) { pt.x = 34, pt.y = 4; gotoxy(pt); cout << "删除失败,没有这门课。\n"; return; } for (int i = k; i < m; ++i) { course[i] = course[i + 1]; } ChangeWhatNum(m - 1); pt.x = 34, pt.y = 4; gotoxy(pt); cout << "删除成功\n"; return; } }
void Assgement::Classbecome() { if (back()) return; else { int n; pt.x = 24, pt.y = 3; gotoxy(pt); cout << "输入第几学期:"; cin >> n; int ss[6][6]; memset(ss, 0, sizeof(ss)); int num[20]; int ans = 0, co = 0; int m = GetWhatNum(); for (int i = 1; i <= m; ++i) if (course[i].period == n) { num[ans++] = course[i].Coursenum; co += course[i].mm; } int zhoushu = co / 15; int k; for (int i = 0; i < zhoushu; ++i) { int x, y; k = i % ans; x = num[k] % 4 + 1; y = (num[k] * ans) % 5 + 1; if (ss[x][y] == 0) { ss[x][y] = num[k]; } else { while (1) { int xx, yy; x++; xx = x % 4 + 1; yy = y % 5 + 1; if (ss[xx][yy] == 0) { ss[xx][yy] = num[k]; break; } } } } for (int i = 1; i <= 4; ++i) { for (int j = 1; j <= 5; ++j) { if (ss[i][j] > 0) { pt.x = 50 + (j - 1) * 18; pt.y = 7 + (i - 1) * 2; gotoxy(pt); printf("%s\n", course[ss[i][j]].Coursename); } // printf("\n"); } }
return;
}
} void Assgement::Alert() { int month, day; int m, d; clock_t temp; m =1; d = 1; pt.x = 60, pt.y = 13; gotoxy(pt); cout << "今天是1月1号" << endl; pt.x = 60, pt.y = 15; gotoxy(pt); cout << "请输入要提醒的时间:"; cin >> month >> day; if (d <= day) { d = day - d; m = month - m; } else { m = m - month - 1; d = day + 30 - d; } //时间转换 if (m == 0) { d = d * 24 * 3600 / 10; } else { d = (m * 30 + d) * 3600 / 10; } while (d > clock()) { temp = clock(); pt.x = 60; pt.y = 17; gotoxy(pt); cout << d - temp; } if (temp = clock()) { PlaySound(TEXT("E:\1.wav"), NULL, SND_FILENAME | SND_ASYNC); qingping(); pt.x = 60; pt.y = 20; gotoxy(pt); cout << "您有一个提醒!!!" << endl; pt.x = 70; pt.y = 22; gotoxy(pt); system("pause"); }
}
void Assgement::jishi() { int e; char c; c=getchar(); pt.x=60,pt.y=15; gotoxy(pt); cout << "1.添加" << "2.删除" << "3.编辑提醒信息" << endl; pt.x=60,pt.y=16; gotoxy(pt); cin >> e; switch (e) { case 1: qingping(); pt.x = 60, pt.y = 15; gotoxy(pt); cout << "请输入信息:"; cin >> things; pt.x = 60, pt.y = 16; gotoxy(pt); cout << "创建完成\n"; getchar(); getchar(); break; case 2: qingping(); pt.x = 60, pt.y = 15; gotoxy(pt); cout << "删除成功!" << endl; getchar(); getchar(); break; case 3: pt.x = 60, pt.y = 15; gotoxy(pt); cout << "请输入信息:"; cin >> things; c = getchar(); break; } }
void Assgement::chaxun() { char c; pt.x=60,pt.y=15; gotoxy(pt); cout<<"你的记事如下:\n"; pt.x=64,pt.y=18; gotoxy(pt); cout<<things; c=getchar(); getchar(); getchar(); } void Assgement::specialclass() { int i; int num=0; char TeShu[20] = "大学外语"; for (i = 0;i<100; i++) { if (strcmp(TeShu, course[i].Coursename) == 0) { num++; }
}
if (num == 0)
{
pt.x = 60, pt.y = 15;
gotoxy(pt);
cout << "没有这门课的提醒!!!\n";
}
else
{
pt.x = 60, pt.y = 15;
gotoxy(pt);
cout << "本周大学外语有" << num << "节" << endl;
}
getchar();
getchar();
}
问题啥的都没有的,嘿嘿,初次创作,脑筋也不太好使。