📄 viewpage.h
字号:
#include<iostream.h>
#include<string.h>
#include<stdlib.h>
#include <stdio.h>
#include<conio.h>
#include <process.h>
#define MAX 20
class Student{
friend class Viewpage;
char*name;
char id[MAX];//学号
char password[MAX];
char *department;
float scores;//总学分
public:
Student(){scores=0;}
};
class Viewpage{
public:
bool check(char i[MAX],char pw[MAX]);//核对学号与密码是否相符
void showInfo();
void menu();
void add();
void del();
void draw();//抽签
void print();
void exitpro();
private:
int count;//需抽签的课程数
Student s;
void badchoice();////防止用户输入错误选择
};
bool Viewpage::check(char i[MAX],char pw[MAX])
{
strcpy(s.id,i);
strcpy(s.password,pw);
return true;
}
void Viewpage::showInfo()
{
int i,j;
//显示学生信息
cout <<"id: "<<s.id<<" "<<"name:"<<" "<<"department: ";
cout << endl;
cout<<"您的课程表:\n";
cout<<"========================================================\n";
cout<<endl;
cout<<"周一:"<<endl;
for(j=0;j<5;j++)
{
cout<<"第"<<j+1<<"大节 :"<<" ";
}
cout<<endl;
cout<<endl;
cout<<"周二:"<<endl;
for(j=0;j<5;j++)
{
cout<<"第"<<j+1<<"大节 :"<<" ";
}
cout<<endl;
cout<<endl;
cout<<"周三:"<<endl;
for(j=0;j<5;j++)
{
cout<<"第"<<j+1<<"大节 :"<<" ";
}
cout<<endl;
cout<<endl;
cout<<"周四:"<<endl;
for(j=0;j<5;j++)
{
cout<<"第"<<j+1<<"大节 :"<<" ";
}
cout<<endl;
cout<<endl;
cout<<"周五:"<<endl;
for(j=0;j<5;j++)
{
cout<<"第"<<j+1<<"大节 :"<<" ";
}
cout<<endl;
cout<<endl;
cout<<"周六:"<<endl;
for(j=0;j<5;j++)
{
cout<<"第"<<j+1<<"大节 :"<<" ";
}
cout<<endl;
cout<<endl;
cout<<"周日:"<<endl;
for(j=0;j<5;j++)
{
cout<<"第"<<j+1<<"大节 :"<<" ";
}
cout<<endl;
cout<<endl;
for(j=0;j<5;j++)
{
cout<<"第"<<j+1<<"大节 :"<<" ";
}
cout<<endl;
cout<<"========================================================\n";
cout<<"您共选择了"<<s.scores<<"学分的课\n";
cout<<"您需要抽签的课程为:";
cout<<endl;
cout<<endl;
}
void Viewpage::add()
{
cout<<"Sorry,this system is incomplete!"<<endl;
cout<<endl;
cout << "press any key to continue!\n";
getch();
menu();
}
void Viewpage::del()
{
cout<<"Sorry,this system is incomplete!"<<endl;
cout<<endl;
cout << "press any key to continue!\n";
getch();
menu();
}
void Viewpage::draw()
{
cout<<"Sorry,this system is incomplete!"<<endl;
cout<<endl;
cout << "press any key to continue!\n";
getch();
menu();
}
void Viewpage::print()
{
cout<<"Sorry,this system is incomplete!"<<endl;
cout<<endl;
cout << "press any key to continue!\n";
getch();
menu();
}
void Viewpage::badchoice()
{
cout << "input error ! \n";
cout<<endl;
cout << "press any key to continue!\n";
getch();
menu();
}
void Viewpage::exitpro()
{
cout<< "==================== Good-bye ======================\n";
exit(1);
}
void Viewpage::menu()
{
char input;
system("cls"); //执行系统命令:cls-清屏
showInfo();
cout << endl;
cout << "==================== 菜 单 ======================\n";
cout << endl;
cout << " 1:增加课程 2:删除课程 3:抽签\n";
cout << endl;
cout << " 4:打印课表 5:退出系统\n";
cout << endl;
cout << "请输入你的选择: ";
cin >> input;
cout << endl;
cout << "========================================================\n";
cout << endl;
switch (input)
{
case '1':add();
break;
case '2':del();
break;
case '3':draw();
break;
case '4':print();
break;
case '5':exitpro();
default: badchoice();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -