Вы находитесь на странице: 1из 20

/* C++ Project * Students' Result Database System * * Author: * Sidharth Patro * XII A */ #include<fstream.h> #include<conio.h> #include<stdio.h> #include<string.

h> class stud { // Private Members char name[20]; char stream[6]; int rank; int adm_no; int roll_no; int std; float marks[5]; float total; float perc; public: void getd(); void showd(); void modify(); int retroll_no() { return roll_no;} int retadm_no() { return adm_no;} int retclass() { return std;} char *retname() { return name;} char *retstream() { return stream; } float retperc() { return perc; } float rettotal() { return total;} float retmarks(int m) { return marks[m];} }s1; //Public Members.

long ptr; void dispbound(int n,char s) { int k=0; while(k<=n) { cout<<s; k++;} } //Display boundary.

void stud::getd() //Input data from user. { cout<<"\nEnter name: "; gets(name); cout<<"Enter admission number: "; cin>>adm_no; cout<<"Enter roll number: "; cin>>roll_no; cout<<"\nEnter class or standard(1-12): "; cin>>std; if(std>=11&&std<=12&&std>=1) { cout<<"\nEnter stream (COMP/ECO/MED/PHYSED/HUMNT): "; gets(stream); } else { strcpy(stream,"NONE"); } int i=1; total=0;; while(i<=5) { cout<<"Enter marks in subject "<<i<<": "; cin>>marks[i-1]; i++; }; total=marks[0]+marks[1]+marks[2]+marks[3]+marks[4]; perc=total/5; cout<<"\n"; dispbound(35,196); cout<<endl; }; void stud::showd() //Display record details. { cout<<"\nName: "; puts(name); cout<<"Admission number: "; cout<<adm_no; cout<<" Roll number: "; cout<<roll_no; cout<<" Class: "; cout<<std; cout<<"\nStream: "; puts(stream); cout<<"\nMarks: "<<marks[0]<<" "<<marks[1]<<" "<<marks[2]<<" "<<marks[3]<<" "<<marks[4]; cout<<"\nTotal: "; cout<<total; cout<<" Percentage: "; cout<<perc; cout<<"\n"; dispbound(35,196); cout<<endl; }; void stud::modify() { char tempname[20],tempstream[6],ans2; int tempadm_no,temproll_no,tempstd; fl oat tempmarks[5];

cout<<"\nName: "<<name; cout<<"\nModify name? (Y/N) "; cin>>ans2; if(ans2=='y' ans2=='Y') { cout<<"Enter new name: "; gets(tempname); cout<<"Name successfully changed from "<<name<<" to "<<tempname; strcpy(name,tempname); } dispbound(30,196); cout<<"\nStream: "<<stream; cout<<"\nModify stream? (Y/N) "; cin>>ans2; if(ans2=='y' ans2=='Y') { cout<<"Enter new stream: "; gets(stream); cout<<"Stream successfully changed from "<<stream<<" to "<<temps tream; strcpy(stream,tempstream); } dispbound(30,196); cout<<"\nAdmission number: "<<adm_no; cout<<"\nModify admission number? (Y/N) "; cin>>ans2; if(ans2=='y' ans2=='Y') { cout<<"Enter new admission number: "; cin>>tempadm_no; cout<<"Admission number successfully changed from "<<adm_no<<" t o "<<tempadm_no<<"\n"; adm_no=tempadm_no; } dispbound(30,196); cout<<"\nRoll number: "<<roll_no; cout<<"\nModify roll number? (Y/N) "; cin>>ans2; if(ans2=='y' ans2=='Y') { cout<<"Enter new roll number: "; cin>>temproll_no; cout<<"Roll no successfully changed from "<<roll_no<<" to "<<rol l_no<<"\n"; roll_no=temproll_no; } dispbound(30,196); cout<<"\nClass: "<<std; cout<<"\nModify class? (Y/N) "; cin>>ans2; if(ans2=='y' ans2=='Y') { cout<<"Enter new class: "; cin>>tempstd; cout<<"Class successfully changed from "<<std<<" to "<<tempstd<< "\n"; std=tempstd; } for(int I=0;I<=4;I++) { dispbound(30,196); cout<<"\nMarks in subject "<<I+1<<": "<<marks[I]; cout<<"\nModify marks? (Y/N) "; cin>>ans2; if(ans2=='y' ans2=='Y') { cout<<"Enter new marks: "; cin>>tempmarks[I]; cout<<"Marks successfully changed from "<<marks[I]<<" to "<<tempmarks[I]<<"\n"; marks[I]=tempmarks[I]; }

} dispbound(30,196); cout<<"\nPress any key to continue. "; getch(); total=marks[0]+marks[1]+marks[2]+marks[3]+marks[4]; perc=total/5; }; // Non object related code char ans; char c1=201,c2=187,h=205,v=186,c4=188,c3=200,inf=236,h2=196; int ch; fstream file,temp;

void add() //Add a record. { file.open("results.dat",ios::out ios::in ios::binary); temp.open("temp.dat", ios::in ios::out ios::binary); int ch3,flag; char addname[20]; cout<<"\n"; dispbound(20,196); cout<<"\nWhere do you want to add the new record ?"; cout<<"\n1.At the end of database."; cout<<"\n2.At the beginning of database."; cout<<"\n3.After a record name."; cout<<"\n4.After a record number"; cout<<"\n5.Go Back to manipulation interface."; cout<<"\n"; dispbound(20,196); cout<<"\nEnter your option(1-5): "; cin>>ch3; switch(ch3) { case 1:

file.seekg(0,ios::end); do{ s1.getd(); file.write((char*)&s1,sizeof(s1)); file.flush(); cout<<"\nAdd another record?(Y/N)"; cin>>ans; }while(ans=='Y' ans=='y'); file.close(); temp.close(); break; temp.seekg(0); do{ s1.getd(); temp.write((char*)&s1,sizeof(s1)); cout<<"\nAdd another record? (Y/N) "; cin>>ans; }while(ans=='Y' ans=='y'); file.seekg(0); while (file.read((char *)&s1, sizeof(s1))) { temp.write((char *)&s1, sizeof(s1)); }

case 2:

case 3: ou want to add the record: ";

file.close(); temp.close(); remove("results.dat"); rename("temp.dat", "results.dat"); break; clrscr(); cout<<"\n"; dispbound(25,196); cout<<"\nEnter name of the student after which y fflush(stdin); gets(addname); flag = 1; temp.seekg(0); while (file.read((char *)&s1, sizeof(s1))) { temp.write((char *)&s1, sizeof(s1)); if (strcmpi(addname, s1.retname())==0) { flag = 0; break; } } if (!flag) { do{

cout<<"\nEnter new student's rec s1.getd(); temp.write((char*)&s1,sizeof(s1)

ord"; ); clrscr(); cout<<"\nAdd another record? Y/N) "; cin>>ans; }while(ans=='Y' ans=='y'); while (file.read((char *)&s1, sizeof(s1) )) { temp.write((char *)&s1, sizeof(s 1)); } remove("results.dat"); rename("temp.dat", "results.dat"); } else { ion failed. Press any key to continue."; getchar(); } break; case 4: cout<<"\nEnter Admission Number of the student a fter which you want to add the record: "; cin >> ch3; cout<<"\n"; dispbound(30,196); cout<<"\nGiven name doesn't exist.Insert (

flag = 1; temp.seekg(0); while (file.read((char *)&s1, sizeof(s1))) { temp.write((char *)&s1, sizeof(s1)); if (ch3 == s1.retadm_no()) { flag = 0; break; } } ptr=temp.tellp(); ptr+=sizeof(s1); if (!flag) { do{ ord."; s1.getd(); temp.write((char*)&s1,sizeof(s1) ); cout<<"\nAdd another record? (Y /N) "; cin>>ans; }while(ans=='Y' ans=='y'); while (file.read((char *)&s1, sizeof(s1) )) { temp.write((char *)&s1, sizeof(s 1)); } remove("results.dat"); rename("temp.dat", "results.dat"); cout<<"\n"; dispbound(30,196); cout<<"Given admission number doesn't ex ist. Insertion failed. Press any key to continue."; getchar(); } break; case 5: break; default: cout<<"\nInvalid Choice. Please enter a correct choice next time and any key to continue."; getchar(); } file.close(); temp.close(); }; void showall() { //Show all records. } else {

cout<<"\nEnter new student's rec

file.open("results.dat",ios::in ios::binary); clrscr(); file.seekg(0); while(file.read((char*)&s1,sizeof(s1))) { cout<<"\n"; dispbound(25,196); s1.showd(); cout<<"\n"; dispbound(25,196); } cout<<"\nPress any key to continue. "; getch(); file.close(); }; void search() //Search for a specific record. { file.open("results.dat",ios::in ios::binary); char inpname[20]; int inproll_no,inpadm_no,flag=0; clrscr(); cout<<"\nEnter the parameter you want to search with. "; cout<<"\n"; dispbound(25,196); cout<<"\n1.Name."; cout<<"\n2.Roll number."; cout<<"\n3.Admission number."; cout<<"\n4.Go back to manipulation interface."; cout<<"\n"; dispbound(25,196); cout<<"\nEnter your choice (1-4): "; cin>>ch; file.seekg(0); switch(ch) { case 1: cout<<"\n"; dispbound(25,196); cout<<"\nInput the name you want to search for: "; gets(inpname); while(file.read((char*)&s1,sizeof(s1))) { if(strcmpi(s1.retname(),inpname)==0) { flag=1; cout<<"\n"; dispbound(25,196); cout<<"\n:::::Record found::::::"; cout<<"\n"; dispbound(25,196); s1.showd(); cout<<"\nPress any key to continue."; getch(); } } if(flag==0) { cout<<"\n"; dispbound(25,196); cout<<"\nSearch failed.No record exists with the name "<<inpname<<". Press any key to continue,"; getch(); } break; case 2: cout<<"\n"; dispbound(25,196); cout<<"\nInput the roll number you want to search for: " ; cin>>inproll_no;

while(file.read((char*)&s1,sizeof(s1))) { if(inproll_no==s1.retroll_no()) { flag=1; cout<<"\n"; dispbound(25,196); cout<<"\n:::::Record found::::::"; cout<<"\n"; dispbound(25,196); s1.showd(); cout<<"\nPress any key to continue."; getch(); } } if(flag==0) { cout<<"\n"; dispbound(25,196); cout<<"\nSearch failed.No record exists with the roll no "; cout<<inproll_no; cout<<". Press any key to continue."; getch(); } break; case 3: cout<<"\n"; dispbound(25,196); cout<<"\nInput the admission number you want to search f or: "; cin>>inpadm_no; while(file.read((char*)&s1,sizeof(s1))) { if(s1.retadm_no()==inpadm_no) { flag=1; cout<<"\n"; dispbound(25,196); cout<<"\n:::::Record found::::::"; cout<<"\n"; dispbound(25,196); s1.showd(); cout<<"\nPress any key to continue."; getch(); } } if(flag==0) { cout<<"\n"; dispbound(25,196); cout<<"\nSearch failed::::::\nNo record exists with th e admission number "; cout<<inpadm_no; cout<<". Press any key to continue."; getch(); } break; case 4: break; default: cout<<"\nPlease enter a valid choice number. Press any k ey to continue."; getch(); } file.close(); }; void mod() //Modify a specific record. { clrscr(); file.open("results.dat",ios::in ios::out ios::binary); char inpname[20]; int inproll_no,inpadm_no,flag=0;

cout<<"\nEnter the criterion you want to be searched and modified for. " ; cout<<"\n"; dispbound(35,196); cout<<"\n1.Name."; cout<<"\n2.Roll number."; cout<<"\n3.Admission number. "; cout<<"\n4.Go back to manipulation interface."; cout<<"\n"; dispbound(35,196); cout<<"\nPlease enter 1/2/3/4: "; cin>>ch; file.seekg(0); switch(ch) { case 1: clrscr(); cout<<"\Input the name you want to search for: "; gets(inpname); clrscr(); while(file.read((char*)&s1,sizeof(s1))) { if(strcmpi(s1.retname(),inpname)==0) { flag=1; cout<<"\n"; dispbound(30,196); cout<<"\n:::::::Record found::::::"; cout<<"\n"; dispbound(30,196); s1.modify(); } } if(flag==0) cout<<"\nSearch failed.No record exists with the name "<<inpname<<"."; break; case 2: cout<<"\nInput the roll number you want to search for: " ; cin>>inproll_no; while(file.read((char*)&s1,sizeof(s1))) { if(inproll_no==s1.retroll_no()) { flag=1; cout<<"\n"; dispbound(30,196); cout<<"\n:::::::Record found::::::"; cout<<"\n"; dispbound(30,196); s1.modify(); } } if(flag==0) cout<<"\nSearch failed.No record exists with the roll no "; cout<<inproll_no; cout<<"."; cout<<"\nPress any key to continue. "; getch(); break; case 3: cout<<"\nInput the admission number you want to search f or: "; cin>>inpadm_no;

while(file.read((char*)&s1,sizeof(s1))) { if(s1.retadm_no()==inpadm_no) { flag=1; cout<<"\n"; dispbound(30,196); cout<<"\n:::::::Record found::::::"; cout<<"\n"; dispbound(30,196); s1.modify(); } } if(flag==0) cout<<"\nSearch failed::::::\nNo record exists w ith the admission number "; cout<<inpadm_no; cout<<"."; cout<<"\nPress any key to continue. "; getch(); break; case 4:break; default: cout<<"\nPlease enter a valid choice number."; cout<<"\nPress any key to continue. "; getch(); } file.close(); }; void count() //Count number of records in various fields. { file.open("results.dat",ios::in ios::out ios::binary); char sf_stream[6],gl; float sf_perc,sf_marks[5],per; int ch2,cnt=0,sf_cl ass; clrscr(); cout<<"\nEnter the criterion according which you want to count number of records."; cout<<"\n"; dispbound(20,196); cout<<"\n1.Count total number of records in database."; cout<<"\n2.Count number of records belonging to a particular stream."; cout<<"\n3.Count number of records belonging to a particular class."; cout<<"\n4.Go back to manipulation interface."; cout<<"\n"; dispbound(20,196); cout<<"\nEnter your choice (1/2/3/4): "; cin>>ch2; switch(ch2) { case 1: file.seekg(0, ios::end); cnt = file.tellg()/sizeof(s1); cout<<"\n"; dispbound(20,196); cout<<"\nTotal number or records in database= "<<cnt; cout<<"\n"; dispbound(30,196); cout<<"\nPress any key to continue. "; getch(); break; case 2: cout<<"\n"; dispbound(20,196); cout<<"\nEnter the stream: "; gets(sf_stream); while(file.read((char*)&s1,sizeof(s1))) {

if(strcmpi(sf_stream,s1.retstream())==0) cnt++; } cout<<"\n"; dispbound(20,196); cout<<"\nTotal number of records with stream "<<sf_strea m<<" = "<<cnt; cout<<"\n"; dispbound(30,196); cout<<"\nPress any key to continue. "; getch(); break; case 3: cout<<"\n"; dispbound(20,196); cout<<"\nEnter the class: "; cin>>ch2; while(file.read((char*)&s1,sizeof(s1))) { if(ch2 == s1.retclass()) cnt++; } cout<<"\n"; dispbound(20,196); cout<<"\nTotal number of records with class "<<ch2<<" = "<<cnt; cout<<"\n"; dispbound(30,196); cout<<"\nPress any key to continue. "; getch(); break; case 4:break; default:cout<<"\n"; dispbound(20,196); cout<<"Invalid Choice.Please enter correct choice next t ime."; dispbound(30,196); cout<<"\nPress any key to continue. "; getch(); } file.close(); } void sort() //Sort records wrt to a certain criteria. { int ch, i=0, mini=0,j; char chid; file.open("results.dat", ios::in ios::out ios::binary); temp.open("temp.dat",ios::in ios::out ios::binary); file.seekg(0); stud S[20], tempS; clrscr(); cout<<"\nHow do you want to sort the records?"; cout<<"\n"; dispbound(25,196); cout<<"\n1.By Alphabetical Order."; cout<<"\n2.By Percentage."; cout<<"\n3.Go back to manipulation interface."; cout<<"\n"; dispbound(25,196); cout<<"\nEnter your choice (1/2/3): "; cin>>ch;

cout<<"\n"; dispbound(25,196); cout<<"\nIncreasing or decreasing? (I/D): "; cin>>chid; //Read all records into memory. while(file.read((char*)&s1,sizeof(s1))) S[i++]=s1; switch(ch) { case 1: switch(chid) { case 'i': case 'I': for (j=0; j<i; j++) { for(int k=j+1; k<i; k++) if( strcmpi(S[k].retname(), S[j].retna me())< 0 ) { } } break; case 'd': case 'D': for (j=0; j<i; j++) { for(int k=j+1; k<i; k++) if( strcmpi(S[k].retname(), S[j].retna me())> 0 ) { } } break; } file.seekg(0); temp.seekg(0); for(j=0;j<i;j++) temp.write((char*)&S[j],sizeof(S[j])); file.close(); temp.close(); remove("results.dat"); rename("temp.dat","results.dat"); cout<<"\n"; dispbound(25,196); cout<<"\nAll records are sorted aplhabetically. Press an y key to continue."; getch(); break; tempS = S[j]; S[j] = S[k]; S[k] = tempS; tempS = S[j]; S[j] = S[k]; S[k] = tempS;

case 2: switch(chid) { case 'i': case 'I': for (j=0; j<i; j++) { for(int k=j+1; k<i; k++) if( S[k].retperc()<S[j].retperc() ) { } } break; case 'd': case 'D':for (j=0; j<i; j++) { for(int k=j+1; k<i; k++) if( S[k].retperc()> S[j].retperc() ) { } } break; } file.seekg(0); temp.seekg(0); for(j=0;j<i;j++) temp.write((char*)&S[j],sizeof(S[j])); file.close(); temp.close(); remove("results.dat"); rename("temp.dat","results.dat"); cout<<"\n"; dispbound(25,196); cout<<"\nAll records sorted by percentage.Press any key to continue."; getch(); break; case 3: break; default:cout<<"\n"; dispbound(25,196); cout<<"\nInvalid Choice.Please enter a valid choice next time."; getchar(); } file.close(); }; tempS = S[j]; S[j] = S[k]; S[k] = tempS; tempS = S[j]; S[j] = S[k]; S[k] = tempS;

void disptable() //Displays records in arranged tabular manner. { clrscr(); file.open("results.dat",ios::in ios::out ios::binary); char dispadm_no,dispname,disproll_no,dispstream,dispmarks[5],disptotal,disppe rc; cout<<"\nWhich columns do you want to add to table?(Y/N)"; cout<<"\n"; dispbound(30,196); cout<<"\nName "; cin>>dispname; cout<<"Stream "; cin>>dispstream; cout<<"Admission number "; cin>>dispadm_no; cout<<"Roll number "; cin>>disproll_no; for(int j=0;j<5;j++) {cout<<"Marks in subject "<<j+1<<" "; cin>>dispmarks[j];} cout<<"Total "; cin>>disptotal; cout<<"Percentage "; cin>>dispperc; file.seekg(0); clrscr(); cout<<endl; if(dispname=='y') cout<<"NME"; cout<<"\t"; if(dispadm_no=='y') cout<<"ADMNO"; cout<<"\t"; if(dispstream=='y') cout<<"STRM"; cout<<"\t"; if(disproll_no=='y') cout<<"RNO"; cout<<"\t"; for(j=0;j<5;j++) if(dispmarks[j]=='y') {cout<<"MRK"<<j+1; cout<<"\t"; } if(disptotal=='y') cout<<"TOT"; cout<<"\t"; if(dispperc=='y') cout<<"%"; cout<<"\t"; cout<<"\n"; dispbound(50,196); while(file.read((char*)&s1,sizeof(s1))) { cout<<endl; if(dispname=='y') puts(s1.retname()); cout<<"\t"; if(dispadm_no=='y') cout<<s1.retadm_no(); cout<<"\t"; if(dispstream=='y') cout<<s1.retstream(); cout<<"\t"; if(disproll_no=='y') cout<<s1.retroll_no(); cout<<"\t"; for(j=0;j<5;j++) if(dispmarks[j]=='y') {cout<<s1.retmarks(j); cout<<"\t"; } if(disptotal=='y') cout<<s1.rettotal(); cout<<"\t"; if(dispperc=='y') cout<<s1.retperc(); cout<<"\t"; } cout<<"\n"; dispbound(50,196); cout<<"\nPress any key to continue. "; getch(); file.close(); }

void del() //Delete Records. { clrscr(); int no,flag=0; char delname[20]; fstream file("results.dat",ios::in ios::binary); if(!file) {cout<<"n"; dispbound(25,196); cout<<"\nFile not opened.";} temp.open("temp.dat",ios::out ios::binary); file.seekg(0); temp.seekg(0); cout<<"\nChoose the type of deletion operation. "; cout<<"\n"; dispbound(25,196); cout<<"\n1.Delete a record with admission number."; cout<<"\n2.Delete a record with name."; cout<<"\n3.Delete all records."; cout<<"\n4.Go back to manipulation page."; cout<<"\n"; dispbound(25,196); cout<<"\nEnter choice (1-4): "; cin>>no; switch(no) { case 1: cout<<"\n"; dispbound(25,196); cout<<"\nEnter admission number to delete: "; cin>>no; while(file.read((char*)&s1,sizeof(s1))) { if(s1.retadm_no()==no) { flag=1; clrscr(); cout<<"\n"; dispbound(25,196); cout<<"\n::::::Record found::::::\n"; cout<<"\n"; dispbound(25,196); s1.showd(); break; } temp.write((char *)&s1, sizeof(s1)); } if(flag==0) { cout<<"\n"; dispbound(25,196); cout<<"\n::::::Search failed::::::\nNo record exists wit h the admission number "<<no<<"."; file.close(); temp.close(); remove("temp.dat"); } else { cout<<"\n"; dispbound(25,196); cout<<"Are you sure you want to delete?(y/n)"; ans = getchar(); if (ans == 'y') { while(file.read((char*)&s1,sizeof(s1)))

temp.write((char *)&s1, sizeof(s 1)); file.close(); temp.close(); remove("results.dat"); rename("temp.dat", "results.dat"); cout<<"\n"; dispbound(25,196); cout<<"\nRecord deleted successfully. Pr ess any key to continue."; getch(); ans=='n'; } else { file.close(); temp.close(); remove("temp.dat"); cout<<"\n"; dispbound(25,196); cout<<"\nRecord not deleted. Press any k ey to continue"; getch(); } } break; case 2: cout<<"\n"; dispbound(25,196); cout<<"\nEnter name to delete: "; fflush(stdin); gets(delname); while(file.read((char*)&s1,sizeof(s1))) { if(strcmpi(s1.retname(), delname)==0) { flag=1; clrscr(); cout<<"\n"; dispbound(25,196); cout<<"\n:::::Record found::::::\n"; cout<<"\n"; dispbound(25,196); s1.showd(); cout<<"\nPress any key to continue"; getch(); break; } temp.write((char *)&s1, sizeof(s1)); } if(flag==0) { cout<<"\n"; dispbound(25,196); cout<<"\n::::::Search failed::::::\nNo record exists with the name "<<delname<<". Press any key to continue."; getch(); } else { cout<<"\n"; dispbound(25,196); cout<<"\nAre you sure you want to delete? (Y/N) "; ans = getchar(); if (ans == 'y') { while(file.read((char*)&s1,sizeof(s1))) temp.write((char *)&s1, sizeof(s

1)); file.close(); temp.close(); remove("results.dat"); rename("temp.dat", "results.dat"); cout<<"\n"; dispbound(25,196); cout<<"\nRecord deleted successfully.Pre ss any key to continue."; getch(); ans=='n'; } else { file.close(); temp.close(); remove("temp.dat"); cout<<"\n"; dispbound(25,196); cout<<"\nRecord not deleted. Press any key to continue"; } } break; case 3: cout<<"\n"; dispbound(25,196); cout<<"\nAre you sure you want to delete all records? (Y/N)"; cin>>ans; if (ans=='y') { file.close(); remove("results.dat"); cout<<"\n"; dispbound(25,196); cout<<"\nAll records deleted successfully.Press any k ey to continue."; getch(); ans=='n'; } else { cout<<"\n"; dispbound(25,196); cout<<"\nRecords not deleted.Press any key to continue. "; getch(); } break;

case 4:break; default: cout<<"\nPlease enter valid choice number."; break; } }

// Main Function starts void main() {delete("results.dat"); int cho,l; char rep; clrscr(); //INTRO. cout<<"\n"<<c1; dispbound(38,205); cout<<c2; cout<<"\n"<<v<<" STUDENTS' DATABASE SYSTEM "<<v; cout<<"\n"<<c3; dispbound(38,205); cout<<c4; cout<<"\n "<<"By Sidharth Patro"; cout<<"\n"; dispbound(45,196); cout<<"\nThe student database system keeps the "; cout<<"\nacademic records of students and "; cout<<"\nallows user to operate various "; cout<<"\nfunctions and manipulations on them. "; cout<<"\n"; dispbound(45,196); cout<<"\n\nPress any key to continue."; getch(); do{ rep='n'; clrscr(); //MENU. cout<<"\n"<<c1; dispbound(38,205); cout<<c2; cout<<"\n"<<v<<" USER MANIPULATION INTERFACE "<<v; cout<<"\n"<<c3; dispbound(38,205); cout<<c4; cout<<"\n Please select the type of function you want to operate on the databas e."; cout<<"\n"; dispbound(30,196); cout<<"\n1.INSERT. "; cout<<"\n2.DISPLAY."; cout<<"\n3.SEARCH."; cout<<"\n4.MODIFY. "; cout<<"\n5.SORT. "; cout<<"\n6.COUNT "; cout<<"\n7.DELETE "; cout<<"\n8.QUIT. "; cout<<"\n"; dispbound(30,196); cout<<"\nEnter Your Option(1-8): "; cin>>cho; switch(cho) { case 1: clrscr(); cout<<"\n"<<c1; dispbound(15,205); cout<<c2; cout<<endl<<v<<" INSERT "<<v; cout<<"\n"<<c3; dispbound(15,205); cout<<c4; cout<<"\nInserts or adds a record to different "; cout<<"\nlocations of a file wherever the user wants. "; cout<<"\n"; dispbound(25,196); cout<<"\nPress any key to continue."; getch(); add(); break; case 2: clrscr();

cout<<"\n"<<c1; dispbound(15,205); cout<<c2; cout<<endl<<v<<" DISPLAY "<<v; cout<<"\n"<<c3; dispbound(15,205); cout<<c4; cout<<"\nAllows you to display records in normal"; cout<<"\nor tabular manner."; cout<<endl; dispbound(20,196); cout<<"\nHow do you want the records to be displayed?"; cout<<"\n1.In normal manner."; cout<<"\n2.In tabular manner."; cout<<endl; dispbound(20,196); cout<<"\nEnter your choice(1-2): "; cin>>cho; switch(cho) { case 1: cout<<"\n"; dispbound(20,196); showall(); cout<<"\nAll records shown in normal manner."; break; case 2: disptable(); break; default :cout<<"\nPlease enter a correct choice."; } break; case 3: clrscr(); cout<<"\n"<<c1; dispbound(15,205); cout<<c2; cout<<endl<<v<<" SEARCH "<<v; cout<<"\n"<<c3; dispbound(15,205); cout<<c4; cout<<"\nSearch for a specific record using"; cout<<"\nName,Rollno, or admission no and "; cout<<"\ndisplay it."; cout<<"\n"; dispbound(25,196); cout<<"\nPress any key to continue."; getch(); search(); break; case 4: clrscr(); cout<<"\n"<<c1; dispbound(15,205); cout<<c2; cout<<endl<<v<<" MODIFY "<<v; cout<<"\n"<<c3; dispbound(15,205); cout<<c4; cout<<"\nThis function helps you change a"; cout<<"\nspecific record's constituents by"; cout<<"\nfirst searching for it and then "; cout<<"\nmodifying it member by member "; cout<<"\n"; dispbound(30,196); cout<<"\nPress any key to continue."; getchar(); mod(); break; case 5: clrscr(); cout<<"\n"<<c1; dispbound(13,205); cout<<c2; cout<<endl<<v<<" SORT "<<v; cout<<"\n"<<c3; dispbound(13,205); cout<<c4; cout<<"\nSort the records according to "; cout<<"\nnames alphabetically or "; cout<<"\npercentage. "; cout<<"\n"; dispbound(20,196); cout<<"\nPlease press any key to continue.";

getch(); sort(); break; case 6: clrscr(); cout<<"\n"<<c1; dispbound(13,205); cout<<c2; cout<<endl<<v<<" COUNT "<<v; cout<<"\n"<<c3; dispbound(13,205); cout<<c4; cout<<"\nCount the number of records "; cout<<"\naccording to a specific parameter, "; cout<<"\nlike class,stream or total number "; cout<<"\no of records in database. "; cout<<"\n"; dispbound(20,196); cout<<"\nPlease press any key to continue."; getch(); count(); break; case 7: clrscr(); cout<<"\n"<<c1; dispbound(15,205); cout<<c2; cout<<endl<<v<<" DELETE "<<v; cout<<"\n"<<c3; dispbound(15,205); cout<<c4; cout<<"\nDelete all record or specific record"; cout<<"\nby inputting its admission number "; cout<<"\nor name."; cout<<"\n"; dispbound(30,196); cout<<"\nPress any key to continue."; getchar(); del(); break; case 8: clrscr(); cout<<"\n"<<c1; dispbound(13,205); cout<<c2; cout<<endl<<v<<" QUIT "<<v; cout<<"\n"<<c3; dispbound(13,205); cout<<c4; cout<<"\nAre you sure you want to quit? (Y/N) "; cin>>rep; clrscr(); cout<<"\nDatabase is shutting down. All changes are saved."; cout<<"\nPress any key to close application."; getch(); break; default: clrscr(); cout<<"\nPlease enter correct choice."; } }while (rep=='n' rep=='N'); } //Program End.

Вам также может понравиться