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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<windows.h>
#include<cstring>
#include<iomanip>
#include<fstream>
using namespace std;
void gotoxy(int x, int y)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(hConsole,pos);
}
struct StudentName
{
char fname[100];
char lname[100];
int id;
};
struct Subjects
{
char courses[8];
};
main()
{//main start
system("cls");
system("color B");
cout<<"\n\n\t\t ======== ======== ====== ======== ====== ";
cout<<"\n\t\t = = = = = = = = = ";
cout<<"\n\t\t = = = = = = = = ";
cout<<"\n\t\t = ======== = = = = = = = === ";
cout<<"\n\t\t = = = = = = = = ";
cout<<"\n\t\t = = = = = = = = = ";
cout<<"\n\t\t ======== = = = ======== ======= ";
cout<<"\n\t------------------------------------------------------------------";
cout<<"\n\t\t\t Computer Programming 2";
cout<<"\n\t------------------------------------------------------------------";
gotoxy(31,13);cout<<"[ PLEASE WAIT ]"<<endl;
for(int x=0;x<1;x++)
{//start for loop
for (int x=0; x<101; x++)
{//start inner for loop
Sleep(5);
system("color B");
gotoxy(38,15);
cout<<x<<"%";
}//end inner for loop
gotoxy(23,17);
cout<<"DONE! ";
system("Pause");
cout<<"\n\n\n\n\n\n\n\n";
system("cls");
}//end for loop
menu://main menu
system("color B");
cout<<"\t\t\t\tENROLLMENT SYSTEM";
cout<<"\n\n";
cout<<"\t\t*************************************************";
cout<<"\n\t\t*";
cout<<"\t\t 1 - Create\t\t*";
cout<<"\n\t\t*";
cout<<"\t\t 2 - View\t\t *";
cout<<"\n\t\t*";
cout<<"\t\t 3 - Update\t\t*";
cout<<"\n\t\t*";
cout<<"\t\t 4 - Delete\t\t*";
cout<<"\n\t\t*";
cout<<"\t\t 5 - Exit\t\t *";
cout<<"\n";
cout<<"\t\t*************************************************";
int select;
cout<<"\n\n\t\tSelect Any Number: "<<" "; cin>>select;
cin.ignore();
system("cls");
switch(select)
{//start switch
case 1:
StudentName info;
cout<<"Enter your first name: ";
gets(info.fname);
cout<<"\nEnter your last name: ";
gets(info.lname);
cout<<"\nEnter your ID number: ";
cin>>info.id;
system("CLS");
cout<<"\t\t\tUniversity of the Immaculate Conception";
cout<<"\n\t\t\t Enrollment System";
cout<<"\n\t\t------------------------------------------------------";
cout<<"\n\n";
cout<<"\t\tHello: "<<info.lname<<", "<<info.fname<<"!\n";
cout<<"\t\tID number: "<<info.id<<endl;
cout<<"\n\t\tPlease choose your year level: ";
cout<<"\n\t\t[A]1st year 1st semester";
cout<<"\n\t\t[B]1st year 2nd semester";
cout<<"\n\t\t[C]2nd year 1st semester";
cout<<"\n\t\t[D]2nd year 2nd semester";
cout<<"\n\t\t[E]3rd year 1st semester";
cout<<"\n\t\t[F]3rd year 2nd semester";
cout<<"\n\t\t[G]4th year 1st semester";
cout<<"\n\t\t[H]4th year 2nd semester";
cout<<"\n\t\t[I]Exit\n "<<endl;
cout<<"\n\n\t\tYour Choice: ";
char choice;
cin>>choice;
switch(choice)
{//start inner switch
case 'A':
system("CLS");
gotoxy(30,0);cout<<"************************";
gotoxy(30,1);cout<<"** **";
gotoxy(30,2);cout<<"** Course outine **";
gotoxy(30,3);cout<<"** **";
gotoxy(30,4);cout<<"************************";
gotoxy(0,6);cout<<"Course:";
gotoxy(20,6);cout<<"Description:";
gotoxy(50,6);cout<<"Time:";
gotoxy(70,6);cout<<"Day:";
//subjects
cout<<"\tTHEO1 Theology 1 9:00-10:30AM (TuTh)"<<"\n";
cout<<"ENGL1 English 1 10:30-12:00AM (TuTh)"<<"\n";
cout<<"FIL1 Filipino 1 10:30-11:30AM (MWF)"<<"\n";
cout<<"MATH1 Math 1 1:00-2:30PM (TuTh)"<<"\n";
cout<<"PE1 Physical Education 1 7:30-9:00AM (F)"<<"\n";
cout<<"NSTP1 NSTP 1 1:00-4:00 (S)"<<"\n";
cout<<"CORG111 Computer Fundamentals 111 1:30-3:00PM (MF)"<<"\n";
cout<<"CAPP112 Computer Application 112 3:30-4:00PM (MF)"<<"\n";
cout<<"\n";
ofstream crt;
crt.open("EnrollmentFile.txt",ios::binary|ios::app);
crt.write((char *) &info, sizeof(StudentName));
crt<<"\nStudent name: "<<info.lname<<", "<<info.fname<<"\nID number: "<<info.id<<"\nCourses enrolled:\n"<<endl;
Subjects sub;
cout<<"Choose the subjects you want to enroll:\n";
choose:
cin>>sub.courses;
cout<<"You are now enrolled in this subject!";
crt<<"\n"<<sub.courses<<endl;
cout<<"\nDo you want to add another subject?(Y/N)";
char decide;
cin>>decide;
if(decide == 'Y'||decide=='y')
{//start if
goto choose;
}//end if
else if(decide == 'N'||decide == 'n')
{//start else if
crt.close();
}//end else if
cin.ignore();
system("cls");
goto loading;
}//end inner switch
case 2:
system("CLS");
gotoxy(30,0);cout<<"**********************************";
gotoxy(30,1);cout<<"** **";
gotoxy(30,2);cout<<"** X - View Student Info **";
gotoxy(30,3);cout<<"** Y - View Subject Info **";
gotoxy(30,4);cout<<"** **";
gotoxy(30,5);cout<<"**********************************";
cout<<"\n\t\tChoose what you want to view: ";
char choose;
cin>>choose;
switch(choose)
{//start switch choose
case 'X':
ifstream view;
view.open("EnrollmentFile.txt",ios::binary);
if(!view)
{
cout<<"\n\t\tFile could not be open !! ";
system("pause");
system("cls");
goto menu;
}
while(view.read((char *) &info, sizeof(StudentName)))
{
Subjects sub;
cout<<"\nStudent Name: ";
cout<<info.lname<<", "<<info.fname<<endl;
cout<<"\nStudent ID: ";
cout<<info.id;
while(view.read((char *) &sub, sizeof(Subjects)))
{
cout<<"\nSubjects enrolled:\n";
cout<<sub.courses;
}
}
view.close();
getch();
system("cls");
goto menu;
}//end switch choose
/*case 3:
case 4:
case 5:
cout<<"Good Bye!";*/
}// end switch
goto menu;
getch();
}//end main
|