?? 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 + -