#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<fstream.h>
#include<cstring.h>
void menu(void),create(void),search(void),update(void),delet(void);
main()
{
menu();
}
void menu(void)
{
int select;
gotoxy(25,3);cout<<" ENROLLMENT SYSTEM";
cout<<" \n";
gotoxy(15,5);cout<<"*********************************************************";
gotoxy(15,6);cout<<"* *";
gotoxy(15,7);cout<<"* 1 - Create *";
gotoxy(15,8);cout<<"* *";
gotoxy(15,9);cout<<"* 2 - Search *";
gotoxy(15,10);cout<<"* *";
gotoxy(15,11);cout<<"* 3 - Update *";
gotoxy(15,12);cout<<"* *";
gotoxy(15,13);cout<<"* 4 - Delete *";
gotoxy(15,14);cout<<"* *";
gotoxy(15,16);cout<<"* *";
gotoxy(15,17);cout<<"*********************************************************";
gotoxy(28,19);cout<<"Select Any Number: "<<" "; cin>>select;
switch(select)
{
case 1:
create();
break;
case 2:
search();
break;
case 3:
update();
break;
case 4:
delet();
}
}
void create(void)
{
clrscr();
char id[10],fname[10],lname[10],course[1],contact[10],gen[10],save[1];
int fee,age;
ofstream crt;
crt.open("enroll.txt",ios::app);
gotoxy(25,3);cout<<"ENROLLMENT SYSTEM";
cout<<" \n";
cout<<" CREATE RECORD ";
gotoxy(5,5);cout<<"****************************************************";
gotoxy(5,6);cout<<" Student's ID : ";
gotoxy(5,7);cout<<" First Name : ";
gotoxy(5,8);cout<<" Last Name :";
gotoxy(5,9);cout<<" Course [I/C/T]: ";
gotoxy(5,10);cout<<" Description : ";
gotoxy(5,11);cout<<" Contact : ";
gotoxy(5,12);cout<<" Age : ";
gotoxy(5,13);cout<<" Gender : ";
gotoxy(5,14);cout<<" Enrollment Fee : ";
gotoxy(5,15);cout<<"****************************************************";
gotoxy(25,6);cin>>id;
gotoxy(25,7);gets(fname);
gotoxy(25,8);gets(lname);
gotoxy(25,9);gets(course);
if(course[0]=='I'||course[0]=='i')
{
gotoxy(27,10);cout<<"Information Technology";
}
else if(course[0]=='C'||course[0]=='c')
{
gotoxy(27,10);cout<<"Computer Science";
}
else if(course[0]=='T'||course[0]=='t')
{
gotoxy(27,10);cout<<"Computer Technology";
}
else
{
gotoxy(25,9);cout<<"Undifined Letter";
}
gotoxy(25,11);gets(contact);
gotoxy(25,12);cin>>age;
gotoxy(25,13);gets(gen);
gotoxy(25,14);cin>>fee;
gotoxy(25,17);cout<<"Save [Y/N]:";
gotoxy(40,17);cin>>save;
if(save[0]=='Y')
{
crt<<id<<"/"<<fname<<"/"<<lname<<"/"<<course<<"/"<<contact<<"/"<<age<<"/"<<gen<<"/"<<fee<<endl;
gotoxy(45,18);cout<<"File Successful save";
}
else if(save[0]=='N')
{
crt.close();
}
getch();
clrscr();
menu();
}
void search(void)
{
clrscr();
string fid[10],ffname[10],flname[10],fcourse[10],fcontact[10],fage[10],fgen[10],fen[10];
char code[10];
int ctr=0;
ifstream srch;
srch.open("enroll.txt");
gotoxy(25,3);cout<<"ENROLLMENT SYSTEM";
cout<<" \n";
cout<<" SEARCH RECORD ";
gotoxy(5,5);cout<<"****************************************************";
gotoxy(5,6);cout<<" Student's ID : ";
gotoxy(5,7);cout<<"****************************************************";
gotoxy(25,6);cin>>code;
while(!srch.eof())
{
getline(srch,fid[ctr],'/');
getline(srch,ffname[ctr],'/');
getline(srch,flname[ctr],'/');
getline(srch,fcourse[ctr],'/');
getline(srch,fcontact[ctr],'/');
getline(srch,fage[ctr],'/');
getline(srch,fgen[ctr],'/');
getline(srch,fen[ctr],'\n');
if(code==fid[ctr])
{
gotoxy(5,8);cout<<" First Name : ";
gotoxy(5,9);cout<<" Last Name :";
gotoxy(5,10);cout<<" Course [I/C/T]: ";
gotoxy(5,11);cout<<" Description : ";
gotoxy(5,12);cout<<" Contact : ";
gotoxy(5,13);cout<<" Age : ";
gotoxy(5,14);cout<<" Gender : ";
gotoxy(5,15);cout<<" Enrollment Fee : ";
gotoxy(5,16);cout<<"****************************************************";
gotoxy(25,8);cout<<ffname[ctr];
gotoxy(25,9);cout<<flname[ctr];
gotoxy(25,10);cout<<fcourse[ctr];
gotoxy(25,12);cout<<fcontact[ctr];
gotoxy(25,13);cout<<fage[ctr];
gotoxy(25,14);cout<<fgen[ctr];
gotoxy(25,15);cout<<fen[ctr];
if(fcourse[ctr]=='I'||fcourse[ctr]=='i')
{
gotoxy(25,11);cout<<"Information Technology";
}
else if(fcourse[ctr]=='C'||fcourse[ctr]=='c')
{
gotoxy(25,11);cout<<"Computer Science";
}
else if(fcourse[ctr]=='T'||fcourse[ctr]=='I')
{
gotoxy(25,11);cout<<"Computer Technology";
}
else
{
gotoxy(25,11);cout<<"Undifined Letter";
}
}
ctr++;
}
srch.close();
getch();
clrscr();
menu();
}
void update(void)
{
clrscr();
string fid[10],ffname[10],flname[10],fcourse[10],fcontact[10],fage[10],fgen[10],fen[10];
char fname[10],lname[10],course,gen[10],code[10],update;
int ctr=0,contact,age,fee;
ifstream srch;
srch.open("enroll.txt");
ofstream up;
up.open("temp.txt",ios::app);
gotoxy(25,3);cout<<"ENROLLMENT SYSTEM";
cout<<" \n";
cout<<" UPDATE RECORD ";
gotoxy(5,5);cout<<"****************************************************";
gotoxy(5,6);cout<<" Student's ID : ";
gotoxy(5,7);cout<<"****************************************************";
gotoxy(25,6);cin>>code;
while(!srch.eof())
{
getline(srch,fid[ctr],'/');
getline(srch,ffname[ctr],'/');
getline(srch,flname[ctr],'/');
getline(srch,fcourse[ctr],'/');
getline(srch,fcontact[ctr],'/');
getline(srch,fage[ctr],'/');
getline(srch,fgen[ctr],'/');
getline(srch,fen[ctr],'\n');
if(code==fid[ctr])
{
gotoxy(5,8);cout<<" [A]First Name : ";
gotoxy(5,9);cout<<" [B]Last Name :";
gotoxy(5,10);cout<<" [C]Course [I/C/T]: ";
gotoxy(5,11);cout<<" Description : ";
gotoxy(5,12);cout<<" [D]Contact : ";
gotoxy(5,13);cout<<" [E]Age : ";
gotoxy(5,14);cout<<" [F]Gender : ";
gotoxy(5,15);cout<<" [G]Enrollment Fee : ";
gotoxy(5,16);cout<<"****************************************************";
gotoxy(25,8);cout<<ffname[ctr];
gotoxy(25,9);cout<<flname[ctr];
gotoxy(25,10);cout<<fcourse[ctr];
gotoxy(25,12);cout<<fcontact[ctr];
gotoxy(25,13);cout<<fage[ctr];
gotoxy(25,14);cout<<fgen[ctr];
gotoxy(25,15);cout<<fen[ctr];
if(fcourse[ctr]=='I'||fcourse[ctr]=='i')
{
gotoxy(25,11);cout<<"Information Technology";
}
else if(fcourse[ctr]=='C'||fcourse[ctr]=='c')
{
gotoxy(25,11);cout<<"Computer Science";
}
else if(fcourse[ctr]=='T'||fcourse[ctr]=='I')
{
gotoxy(25,11);cout<<"Computer Technology";
}
else
{
gotoxy(25,11);cout<<"Undifined Letter";
}
gotoxy(5,17);cout<<"SELECT LETTER TO UPDATE [A/B/C/D/E/F/G]: ";
gotoxy(45,17);cin>>update;
if(update=='A')
{
gotoxy(25,8);cout<<" ";
gotoxy(25,8);gets(fname);
gotoxy(25,8);cout<<endl;
up<<fid[ctr]<<"/"<<fname<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='B')
{
gotoxy(25,9);cout<<" ";
gotoxy(25,9);gets(lname);
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<lname<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='C')
{
gotoxy(25,10);cout<<" ";
gotoxy(25,10);cin>>course;
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<course<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='D')
{
gotoxy(25,12);cout<<" ";
gotoxy(25,12);cin>>contact;
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<contact<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='E')
{
gotoxy(25,13);cout<<" ";
gotoxy(25,13);cin>>age;
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<age<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='F')
{
gotoxy(25,14);cout<<" ";
gotoxy(25,14);gets(gen);
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<gen<<"/"<<fen[ctr]<<endl;
}
if(update=='G')
{
gotoxy(25,15);cout<<" ";
gotoxy(25,15);cin>>fee;
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fee<<endl;
}
}//Close IF
else
{
if(fid[ctr]!=" ")
{
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
}
ctr++;
}//close while
srch.close();
up.close();
remove("enroll.txt");
rename("temp.txt","enroll.txt");
getch();
clrscr();
menu();
}
void delet(void)
{
clrscr();
string fid[10],ffname1[10],flname1[10],fcourse1[10],fcontact1[10],fage1[10],fgen1[10],fen1[10];
char fname1[10],lname1[10],course1,gen1[10],code[10],letter;
int ctr=0,tag=0,contact,age,fee;
ifstream search;
search.open("enroll.txt");
ofstream del;
del.open("temp.txt",ios::in);
gotoxy(25,3);cout<<"ENROLLMENT SYSTEM";
cout<<" \n";
cout<<" DELETE RECORD ";
gotoxy(5,5);cout<<"****************************************************";
gotoxy(5,6);cout<<" Student's ID : ";
gotoxy(5,7);cout<<"****************************************************";
gotoxy(25,6);cin>>code;
while(!search.eof())
{
getline(search,fid[ctr],'/');
getline(search,ffname1[ctr],'/');
getline(search,flname1[ctr],'/');
getline(search,fcourse1[ctr],'/');
getline(search,fcontact1[ctr],'/');
getline(search,fage1[ctr],'/');
getline(search,fgen1[ctr],'/');
getline(search,fen1[ctr],'\n');
if(code==fid[ctr])
{
gotoxy(5,8);cout<<" [A]First Name : ";
gotoxy(5,9);cout<<" [B]Last Name :";
gotoxy(5,10);cout<<" [C]Course [I/C/T]: ";
gotoxy(5,11);cout<<" Description : ";
gotoxy(5,12);cout<<" [D]Contact : ";
gotoxy(5,13);cout<<" [E]Age : ";
gotoxy(5,14);cout<<" [F]Gender : ";
gotoxy(5,15);cout<<" [G]Enrollment Fee : ";
gotoxy(5,16);cout<<"****************************************************";
gotoxy(25,8);cout<<ffname1[ctr];
gotoxy(25,9);cout<<flname1[ctr];
gotoxy(25,10);cout<<fcourse1[ctr];
gotoxy(25,12);cout<<fcontact1[ctr];
gotoxy(25,13);cout<<fage1[ctr];
gotoxy(25,14);cout<<fgen1[ctr];
gotoxy(25,15);cout<<fen1[ctr];
if(fcourse1[ctr]=='I'||fcourse1[ctr]=='i')
{
gotoxy(25,11);cout<<"Information Technology";
}
else if(fcourse1[ctr]=='C'||fcourse1[ctr]=='c')
{
gotoxy(25,11);cout<<"Computer Science";
}
else if(fcourse1[ctr]=='T'||fcourse1[ctr]=='I')
{
gotoxy(25,11);cout<<"Computer Technology";
}
else
{
gotoxy(25,11);cout<<"Undifined Letter";
}
gotoxy(5,17);cout<<" Press [D] to Delete record,[C] to Cancel :"<<"[";cin>>letter;cout<<"]";
if(letter=='D'||letter=='d')
{
gotoxy(45,18);cout<< "Record DELETE";
tag=1;
}
if (letter=='C'||letter=='c')
{
search.close();
del.close();
remove("temp.txt");
}
}
else
{
if(fid[ctr]!=" ")
{
del<<fid[ctr]<<"/"<<ffname1[ctr]<<"/"<<flname1[ctr]<<"/"<<fcourse1[ctr]<<"/"<<fcontact1[ctr]<<"/"<<fage1[ctr]<<"/"<<fgen1[ctr]<<"/"<<fen1[ctr]<<endl;
}
}
ctr++;
}
search.close();
del.close();
remove("enroll.txt");
rename("temp.txt","enroll.txt");
getch();
clrscr();
menu();
}
#include<conio.h>
#include<stdio.h>
#include<fstream.h>
#include<cstring.h>
void menu(void),create(void),search(void),update(void),delet(void);
main()
{
menu();
}
void menu(void)
{
int select;
gotoxy(25,3);cout<<" ENROLLMENT SYSTEM";
cout<<" \n";
gotoxy(15,5);cout<<"*********************************************************";
gotoxy(15,6);cout<<"* *";
gotoxy(15,7);cout<<"* 1 - Create *";
gotoxy(15,8);cout<<"* *";
gotoxy(15,9);cout<<"* 2 - Search *";
gotoxy(15,10);cout<<"* *";
gotoxy(15,11);cout<<"* 3 - Update *";
gotoxy(15,12);cout<<"* *";
gotoxy(15,13);cout<<"* 4 - Delete *";
gotoxy(15,14);cout<<"* *";
gotoxy(15,16);cout<<"* *";
gotoxy(15,17);cout<<"*********************************************************";
gotoxy(28,19);cout<<"Select Any Number: "<<" "; cin>>select;
switch(select)
{
case 1:
create();
break;
case 2:
search();
break;
case 3:
update();
break;
case 4:
delet();
}
}
void create(void)
{
clrscr();
char id[10],fname[10],lname[10],course[1],contact[10],gen[10],save[1];
int fee,age;
ofstream crt;
crt.open("enroll.txt",ios::app);
gotoxy(25,3);cout<<"ENROLLMENT SYSTEM";
cout<<" \n";
cout<<" CREATE RECORD ";
gotoxy(5,5);cout<<"****************************************************";
gotoxy(5,6);cout<<" Student's ID : ";
gotoxy(5,7);cout<<" First Name : ";
gotoxy(5,8);cout<<" Last Name :";
gotoxy(5,9);cout<<" Course [I/C/T]: ";
gotoxy(5,10);cout<<" Description : ";
gotoxy(5,11);cout<<" Contact : ";
gotoxy(5,12);cout<<" Age : ";
gotoxy(5,13);cout<<" Gender : ";
gotoxy(5,14);cout<<" Enrollment Fee : ";
gotoxy(5,15);cout<<"****************************************************";
gotoxy(25,6);cin>>id;
gotoxy(25,7);gets(fname);
gotoxy(25,8);gets(lname);
gotoxy(25,9);gets(course);
if(course[0]=='I'||course[0]=='i')
{
gotoxy(27,10);cout<<"Information Technology";
}
else if(course[0]=='C'||course[0]=='c')
{
gotoxy(27,10);cout<<"Computer Science";
}
else if(course[0]=='T'||course[0]=='t')
{
gotoxy(27,10);cout<<"Computer Technology";
}
else
{
gotoxy(25,9);cout<<"Undifined Letter";
}
gotoxy(25,11);gets(contact);
gotoxy(25,12);cin>>age;
gotoxy(25,13);gets(gen);
gotoxy(25,14);cin>>fee;
gotoxy(25,17);cout<<"Save [Y/N]:";
gotoxy(40,17);cin>>save;
if(save[0]=='Y')
{
crt<<id<<"/"<<fname<<"/"<<lname<<"/"<<course<<"/"<<contact<<"/"<<age<<"/"<<gen<<"/"<<fee<<endl;
gotoxy(45,18);cout<<"File Successful save";
}
else if(save[0]=='N')
{
crt.close();
}
getch();
clrscr();
menu();
}
void search(void)
{
clrscr();
string fid[10],ffname[10],flname[10],fcourse[10],fcontact[10],fage[10],fgen[10],fen[10];
char code[10];
int ctr=0;
ifstream srch;
srch.open("enroll.txt");
gotoxy(25,3);cout<<"ENROLLMENT SYSTEM";
cout<<" \n";
cout<<" SEARCH RECORD ";
gotoxy(5,5);cout<<"****************************************************";
gotoxy(5,6);cout<<" Student's ID : ";
gotoxy(5,7);cout<<"****************************************************";
gotoxy(25,6);cin>>code;
while(!srch.eof())
{
getline(srch,fid[ctr],'/');
getline(srch,ffname[ctr],'/');
getline(srch,flname[ctr],'/');
getline(srch,fcourse[ctr],'/');
getline(srch,fcontact[ctr],'/');
getline(srch,fage[ctr],'/');
getline(srch,fgen[ctr],'/');
getline(srch,fen[ctr],'\n');
if(code==fid[ctr])
{
gotoxy(5,8);cout<<" First Name : ";
gotoxy(5,9);cout<<" Last Name :";
gotoxy(5,10);cout<<" Course [I/C/T]: ";
gotoxy(5,11);cout<<" Description : ";
gotoxy(5,12);cout<<" Contact : ";
gotoxy(5,13);cout<<" Age : ";
gotoxy(5,14);cout<<" Gender : ";
gotoxy(5,15);cout<<" Enrollment Fee : ";
gotoxy(5,16);cout<<"****************************************************";
gotoxy(25,8);cout<<ffname[ctr];
gotoxy(25,9);cout<<flname[ctr];
gotoxy(25,10);cout<<fcourse[ctr];
gotoxy(25,12);cout<<fcontact[ctr];
gotoxy(25,13);cout<<fage[ctr];
gotoxy(25,14);cout<<fgen[ctr];
gotoxy(25,15);cout<<fen[ctr];
if(fcourse[ctr]=='I'||fcourse[ctr]=='i')
{
gotoxy(25,11);cout<<"Information Technology";
}
else if(fcourse[ctr]=='C'||fcourse[ctr]=='c')
{
gotoxy(25,11);cout<<"Computer Science";
}
else if(fcourse[ctr]=='T'||fcourse[ctr]=='I')
{
gotoxy(25,11);cout<<"Computer Technology";
}
else
{
gotoxy(25,11);cout<<"Undifined Letter";
}
}
ctr++;
}
srch.close();
getch();
clrscr();
menu();
}
void update(void)
{
clrscr();
string fid[10],ffname[10],flname[10],fcourse[10],fcontact[10],fage[10],fgen[10],fen[10];
char fname[10],lname[10],course,gen[10],code[10],update;
int ctr=0,contact,age,fee;
ifstream srch;
srch.open("enroll.txt");
ofstream up;
up.open("temp.txt",ios::app);
gotoxy(25,3);cout<<"ENROLLMENT SYSTEM";
cout<<" \n";
cout<<" UPDATE RECORD ";
gotoxy(5,5);cout<<"****************************************************";
gotoxy(5,6);cout<<" Student's ID : ";
gotoxy(5,7);cout<<"****************************************************";
gotoxy(25,6);cin>>code;
while(!srch.eof())
{
getline(srch,fid[ctr],'/');
getline(srch,ffname[ctr],'/');
getline(srch,flname[ctr],'/');
getline(srch,fcourse[ctr],'/');
getline(srch,fcontact[ctr],'/');
getline(srch,fage[ctr],'/');
getline(srch,fgen[ctr],'/');
getline(srch,fen[ctr],'\n');
if(code==fid[ctr])
{
gotoxy(5,8);cout<<" [A]First Name : ";
gotoxy(5,9);cout<<" [B]Last Name :";
gotoxy(5,10);cout<<" [C]Course [I/C/T]: ";
gotoxy(5,11);cout<<" Description : ";
gotoxy(5,12);cout<<" [D]Contact : ";
gotoxy(5,13);cout<<" [E]Age : ";
gotoxy(5,14);cout<<" [F]Gender : ";
gotoxy(5,15);cout<<" [G]Enrollment Fee : ";
gotoxy(5,16);cout<<"****************************************************";
gotoxy(25,8);cout<<ffname[ctr];
gotoxy(25,9);cout<<flname[ctr];
gotoxy(25,10);cout<<fcourse[ctr];
gotoxy(25,12);cout<<fcontact[ctr];
gotoxy(25,13);cout<<fage[ctr];
gotoxy(25,14);cout<<fgen[ctr];
gotoxy(25,15);cout<<fen[ctr];
if(fcourse[ctr]=='I'||fcourse[ctr]=='i')
{
gotoxy(25,11);cout<<"Information Technology";
}
else if(fcourse[ctr]=='C'||fcourse[ctr]=='c')
{
gotoxy(25,11);cout<<"Computer Science";
}
else if(fcourse[ctr]=='T'||fcourse[ctr]=='I')
{
gotoxy(25,11);cout<<"Computer Technology";
}
else
{
gotoxy(25,11);cout<<"Undifined Letter";
}
gotoxy(5,17);cout<<"SELECT LETTER TO UPDATE [A/B/C/D/E/F/G]: ";
gotoxy(45,17);cin>>update;
if(update=='A')
{
gotoxy(25,8);cout<<" ";
gotoxy(25,8);gets(fname);
gotoxy(25,8);cout<<endl;
up<<fid[ctr]<<"/"<<fname<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='B')
{
gotoxy(25,9);cout<<" ";
gotoxy(25,9);gets(lname);
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<lname<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='C')
{
gotoxy(25,10);cout<<" ";
gotoxy(25,10);cin>>course;
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<course<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='D')
{
gotoxy(25,12);cout<<" ";
gotoxy(25,12);cin>>contact;
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<contact<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='E')
{
gotoxy(25,13);cout<<" ";
gotoxy(25,13);cin>>age;
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<age<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
if(update=='F')
{
gotoxy(25,14);cout<<" ";
gotoxy(25,14);gets(gen);
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<gen<<"/"<<fen[ctr]<<endl;
}
if(update=='G')
{
gotoxy(25,15);cout<<" ";
gotoxy(25,15);cin>>fee;
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fee<<endl;
}
}//Close IF
else
{
if(fid[ctr]!=" ")
{
up<<fid[ctr]<<"/"<<ffname[ctr]<<"/"<<flname[ctr]<<"/"<<fcourse[ctr]<<"/"<<fcontact[ctr]<<"/"<<fage[ctr]<<"/"<<fgen[ctr]<<"/"<<fen[ctr]<<endl;
}
}
ctr++;
}//close while
srch.close();
up.close();
remove("enroll.txt");
rename("temp.txt","enroll.txt");
getch();
clrscr();
menu();
}
void delet(void)
{
clrscr();
string fid[10],ffname1[10],flname1[10],fcourse1[10],fcontact1[10],fage1[10],fgen1[10],fen1[10];
char fname1[10],lname1[10],course1,gen1[10],code[10],letter;
int ctr=0,tag=0,contact,age,fee;
ifstream search;
search.open("enroll.txt");
ofstream del;
del.open("temp.txt",ios::in);
gotoxy(25,3);cout<<"ENROLLMENT SYSTEM";
cout<<" \n";
cout<<" DELETE RECORD ";
gotoxy(5,5);cout<<"****************************************************";
gotoxy(5,6);cout<<" Student's ID : ";
gotoxy(5,7);cout<<"****************************************************";
gotoxy(25,6);cin>>code;
while(!search.eof())
{
getline(search,fid[ctr],'/');
getline(search,ffname1[ctr],'/');
getline(search,flname1[ctr],'/');
getline(search,fcourse1[ctr],'/');
getline(search,fcontact1[ctr],'/');
getline(search,fage1[ctr],'/');
getline(search,fgen1[ctr],'/');
getline(search,fen1[ctr],'\n');
if(code==fid[ctr])
{
gotoxy(5,8);cout<<" [A]First Name : ";
gotoxy(5,9);cout<<" [B]Last Name :";
gotoxy(5,10);cout<<" [C]Course [I/C/T]: ";
gotoxy(5,11);cout<<" Description : ";
gotoxy(5,12);cout<<" [D]Contact : ";
gotoxy(5,13);cout<<" [E]Age : ";
gotoxy(5,14);cout<<" [F]Gender : ";
gotoxy(5,15);cout<<" [G]Enrollment Fee : ";
gotoxy(5,16);cout<<"****************************************************";
gotoxy(25,8);cout<<ffname1[ctr];
gotoxy(25,9);cout<<flname1[ctr];
gotoxy(25,10);cout<<fcourse1[ctr];
gotoxy(25,12);cout<<fcontact1[ctr];
gotoxy(25,13);cout<<fage1[ctr];
gotoxy(25,14);cout<<fgen1[ctr];
gotoxy(25,15);cout<<fen1[ctr];
if(fcourse1[ctr]=='I'||fcourse1[ctr]=='i')
{
gotoxy(25,11);cout<<"Information Technology";
}
else if(fcourse1[ctr]=='C'||fcourse1[ctr]=='c')
{
gotoxy(25,11);cout<<"Computer Science";
}
else if(fcourse1[ctr]=='T'||fcourse1[ctr]=='I')
{
gotoxy(25,11);cout<<"Computer Technology";
}
else
{
gotoxy(25,11);cout<<"Undifined Letter";
}
gotoxy(5,17);cout<<" Press [D] to Delete record,[C] to Cancel :"<<"[";cin>>letter;cout<<"]";
if(letter=='D'||letter=='d')
{
gotoxy(45,18);cout<< "Record DELETE";
tag=1;
}
if (letter=='C'||letter=='c')
{
search.close();
del.close();
remove("temp.txt");
}
}
else
{
if(fid[ctr]!=" ")
{
del<<fid[ctr]<<"/"<<ffname1[ctr]<<"/"<<flname1[ctr]<<"/"<<fcourse1[ctr]<<"/"<<fcontact1[ctr]<<"/"<<fage1[ctr]<<"/"<<fgen1[ctr]<<"/"<<fen1[ctr]<<endl;
}
}
ctr++;
}
search.close();
del.close();
remove("enroll.txt");
rename("temp.txt","enroll.txt");
getch();
clrscr();
menu();
}
No comments:
Post a Comment