1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
void gotoxy();
void gotoxy( int column, int line ) {
COORD coord;
coord.X = column;
coord.Y = line;
SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE ), coord );
}
void clearstatus();
void clearstatus() {
for(int x=3;x<=38;x++) {
gotoxy(x,10);
cout << " ";
}
}
void newstudent();
void newstudent(){
string in;
for(int x=4;x<=10;x++)
{
gotoxy(34,x);
cout << "|";
gotoxy(76,x);
cout << "|";
}
gotoxy(35,3);
cout << "---------------NEW STUDENT---------------";
gotoxy(36,4);
cout << "Full Name : ";
gotoxy(36,5);
cout << " Course : ";
gotoxy(36,6);
cout << " Level : ";
gotoxy(36,7);
cout << " Contact# : ";
gotoxy(35,8);
cout << "-----------------------------------------";
gotoxy(48,4);
getline(cin, in);
gotoxy(48,5);
getline(cin, in);
gotoxy(48,6);
getline(cin, in);
gotoxy(48,7);
getline(cin, in);
gotoxy(36,9);
cout << "Do you want to keep the record? [Y/N]-";
getline(cin,in);
gotoxy(80/2-(24/2),18);
cout << "----CONSOLE MESSAGE----";
gotoxy(80/2-(24/2),20);
cout << "-----------------------";
if(in=="y" || in=="Y") {
gotoxy(80/2-(17/2), 19);
cout << "RECORD IS SAVED." << endl;
}
else if(in=="n" || in=="N") {
gotoxy(80/2-(22/2), 19);
cout << "RECORD WAS DISCARDED." << endl;
}
}
//*********************************
//*********************************
int main(int argc, char *argv[])
{
start:
gotoxy(3, 4);
cout << "[F1]--New Student Record";
gotoxy(3, 5);
cout << "[F2]--Students Class Schedules";
gotoxy(3, 6);
cout << "[F3]--Medical Check-up History";
gotoxy(3, 7);
cout << "[F4]--Find Student Record";
gotoxy(3, 8);
cout << "[F5]--Quit Program";
while(1)
{
if(GetAsyncKeyState(0x70))
{
clearstatus();
gotoxy(3,10);
cout << "Status: New Record (F1)" << endl;
newstudent();
break;
}
else if(GetAsyncKeyState(0x71)) {
clearstatus();
gotoxy(3,10);
cout << "Status: Class Schedule (F2)" << endl;
}
else if(GetAsyncKeyState(0x72)) {
clearstatus();
gotoxy(3,10);
cout << "F3 was hit" << endl;
}
else if(GetAsyncKeyState(0x73)) {
clearstatus();
gotoxy(3,10);
cout << "F4 was hit" << endl;
}
else if(GetAsyncKeyState(0x74)) {
clearstatus();
gotoxy(3,10);
cout << "F5 was hit" << endl;
}
else if(GetAsyncKeyState(0x1B)) {
clearstatus();
gotoxy(3,10);
cout << "ESC was hit" << endl;
break;
}
else {
Sleep(10);
}
}
gotoxy(25, 22);
system("PAUSE");
for(int x=3;x<=38;x++) {
gotoxy(x,10);
cout << " ";
}
for(int x=4;x<=10;x++) {
gotoxy(34,x);
cout << " ";
gotoxy(76,x);
cout << " ";
}
for(int x=35;x<=77;x++) {
for(int y=3;y<=10;y++) {
gotoxy(x,y);
cout << " ";
}
}
for(int x=80/2-(32/2);x<=((80/2)-(32/2)+32);x++) {
for(int y=18;y<=22;y++) {
gotoxy(x,y);
cout << " ";
}
}
goto start;
return EXIT_SUCCESS;
}
|