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

/*ajay saklani /* PROJECT */ #include <iostream.h> //For cin &cout function #include <fstream.

h> //To create file stream #include <stdio.h> // #include <string.h> //For various string function #include <dos.h> //For display time #include <conio.h> //For clear screen #include <math.h> //To performe calculation #include <process.h> //To used exit() func struct dosdate_t d; //for date struct time t; //for time fstream f,finout; class School //to get various imformation for the school { private: char Scname[100]; //to store school name char Destination[100]; //to store Location of the school char City[20]; //to store city name char State[20]; //to store state name char Rname[100]; //to store trust name float Phno; //to store telephone no public: void Getentry(void); //to get information void Disschool(void); //to dispaly information void Modify(void); //to modify any information }S; void School ::Getentry(void) //function defination of Getentry() { clrscr(); char ch; cin.get(ch); cout<<"\t\t\tENTER MODE"; cout<<"Enter School name:\n"; gets(Scname); cout<<"Destination:\n"; gets(Destination); cout<<"City:\n"; gets(City); cout<<"State:\n"; gets(State); cout<<"Run by:\n"; gets(Rname); cout<<"Phone:\n"; cin>>Phno; } void School::Disschool(void) //function defination of Disschool() { clrscr(); cout<<"\t\t\tDISPLAY NODE"; cout<<"\t\t\t\n"; puts(Scname); cout<<"\t\t\n"; puts(Destination); cout<<"\t\t\n"<<City; cout<<"\t\t\n"; puts(State); cout<<"\t\t\n"<<Phno; cout<<"\t\t\n"; puts(Rname); } void School::Modify() //function defination of modify { char ch,Scnam[100],Desti[50],Ct[20],St[20],Rnam[50]; //variables to store chan ged information int Ph=0;

finout.open("S",ios::ate|ios::in|ios::out); //file S is open { finout.seekg(0,ios::beg); //to place pointer at begning finout.read((char*)&S,sizeof(School)); //to read from file S.Disschool(); //to dispaly old information } cout<<"\n Want to Modify\n"; cin>>ch; if(ch=='y'||ch=='Y') { cout<<"\t\t\t\t \n"; cout<<"Enter school name\n"; gets(Scnam); cout<<"Enter destination\n"; gets(Desti); cout<<"Enter city \n"; gets(Ct); cout<<"Enter state \n"; gets(St); cout<<"Phone \n";cin>>Ph; cout<<"Run by \n"; gets(Rnam); strcpy(Scname,Scnam); //copy to variables strcpy(Destination,Desti); strcpy(State,St); strcpy(City,Ct); strcpy(Rname,Rnam); Phno=Ph; finout.seekp(0,ios::beg); finout.write((char*)&S,sizeof(School));//to write to the file } f.close(); //to close file } class Teacher //to store teacher information { private: char Pname[30]; //to store principal name char VPname[30]; //to store vice principal name char EIname[30]; //to store examination incharge name char Subname[][20]; //to store subject name char ch; char Tname[][30]; //to store teacher name char Quali[][10]; //to store teacher quilification int expri[]; //to store teacher experience int n,pos; public : Teacher() //constructor {n=0; } void Getdata(void); //to get information void Distea(void); //to dispaly information void Search(void); //to search teacher void Delete(void); //to delete information void Modify(void); //to changed the information }T; void Teacher::Getdata(void) //defination of getdata { clrscr(); char ch; cin.get(ch); cout<<"\t\t\tENTER MODE"; cout<<"\n The Principal Name:"; gets(Pname); cout<<"\n The vice Principal Name:"; gets(VPname); cout<<"\n The Examination Incharge:";

gets(EIname); for(int j=0;j<50;j++) { do { cout<<"\n The Subject in which you want enter teacher:"; gets(Subname[j]); clrscr(); cout<<"\t\t\tENTER MODE"; cout<<"\nNumber of the teacher:"; cin>>n; //for(int i=0;i<n;i++) while(n!=0) { n--; cout<<"\n Teacher:"<<n+1; cout<<"\n Teacher Name:"; gets(Tname[n]); cout<<"\n Qualification: "; gets(Quali[n]); cout<<"\n Exprience:"; cin>>expri[n]; //cout<<"\nwant to enter more\n"; //cin>>ch; }//while(ch=='y'||ch=='Y'); cout<<"Want to enter any more?(y/n)"; cin>>ch; } while(ch=='y'||ch=='Y'); } } void Teacher ::Distea(void) //to dispaly teacher information { clrscr(); int pos; char subname[20]; cout<<"\t\t\tDISPLAY MODE"; cout<<"\nPRINCIPAL:"; puts(Pname); cout<<"\nVICE PRINCIPAL:"; puts(VPname); cout<<"\nEXAMNITION INCHARGE:"; puts(EIname); cout<<"Subject name "; gets(subname); for(int j=0;j<50;j++) { if(strcmp(subname,Subname[j])) { pos=j; cout<<" valid subject name"<<pos; break; } } cout<<"\nNumber of the teacher:"; cout<<n; for(int i=0;i<n;i++) { cout<<"\n Teacher:"<<i+1; cout<<"\n Teacher Name:"; puts(Tname[i]); cout<<"\n Qualification: "; puts(Quali[i]); cout<<"\n Exprience:"; cout<<expri[i]; } } /*void Teacher::Modify()

{ char Pnam[30], VPnam[30],EInam[30],Subnam[][20];//to store the changed informa tion char ch1,ch,Tnam[][30],Qual[][10]; int exp[]; // int n,pos; int t=0,i; finout.open("T",ios::ate|ios::in|ios::out);//to open file T { finout.seekg(0,ios::beg); //to put the file pointer at the be gning finout.read((char*)&T,sizeof(Teacher)); //to read from the file T.Distea(); //to dispaly old information } cout<<"\n Want to Modify\n"; cin>>ch; if(ch=='y'||ch=='Y') { cout<<"\t\t\t\t \n"; cout<<"\n The Principal Name:"; gets(Pnam); cout<<"\n The vice Principal Name:"; gets(VPnam); cout<<"\n The Examination Incharge:"; gets(EInam); for(int j=0;j<50;j++) { do { cout<<"\n The Subject in which you want enter teacher:"; gets(Subnam[j]); clrscr(); cout<<"\t\t\tENTER MODE"; cout<<"\nNumber of the teacher:"; cin>>t; //for(int i=0;i<n;i++) while(t!=0) { t--; cout<<"\n Teacher:"<<t+1; cout<<"\n Teacher Name:"; gets(Tnam[t]); cout<<"\n Qualification: "; gets(Qual[t]); cout<<"\n Exprience:"; cin>>exp[t]; //cout<<"\nwnt to enter more\n"; //cin>>ch; }//while(ch=='y'||ch=='Y'); cout<<"Want to enter any more?(y/n)"; cin>>ch1; } while(ch1=='y'||ch1=='Y'); } strcpy(Pname,Pnam); strcpy(VPname,VPnam); strcpy(EIname,EInam); strcpy(Subname[i],Subnam[t]); n=t; strcpy(Tname[i],Tnam[t]); strcpy(Quali[i],Qual[t]); strcpy(expri[i],exp[t]); finout.seekp(0,ios::beg); finout.write((char*)&T,sizeof(Teacher)); //to write in the file } f.close(); //to close the file }

void Teacher::Search() //defination of search function { finout.open("T",ios::in|ios::binary) //to open file T if(finout==NULL) { cout<<"File does not exit"; return; } while((finout.read((char*)&T,sizeof(Teacher))) to read from the file { char Subname[20]; cout<<"Subject name "; gets(subname); for(int j=0;j<50;j++) { if(strcmp(subname,Subname[j])) { pos=j; cout<<" valid subject name"<<pos; break; } } cout<<"\nNumber of the teacher:"; cout<<n; for(int i=0;i<n;i++) { cout<<"\n Teacher:"<<i+1; cout<<"\n Teacher Name:"; puts(Tname[i]); cout<<"\n Qualification: "; puts(Quali[i]); cout<<"\n Exprience:"; cout<<expri[i]; } } finout.close(); } void Teacher::Delete() //function defination of delete func() { char tnam[20],subname[20];int x=0; cout<<"Subject name \n"; gets(subname); cout<<"\nTeacher name\n"; gets(tnam); finout.open("T",ios::in); finout.open("temp",ios::app|ios::out); while(finout.read((char*)&T,sizeof(Teacher))) { for(int j=0;j<50;j++) { if(strcmp(subname,Subname[j])) { pos=j; cout<<" valid subject name"<<pos; break; } } cout<<"\nNumber of the teacher:"; cout<<n; for(int i=0;i<n;i++) { if(strcmp(tnam,Tname[pos])) x=1; if(x==0) { finout.write((char*)&T,sizeof(Teacher)); } } } finout.close(); finout.close(); finout.open("T",ios::app|ios::out);

finout.open("temp",ios::in); while(finout.read((char*)&T,sizeof(Teacher))) { for(int j=0;j<50;j++) { if(strcmp(subname,Subname[j])) { pos=j; cout<<" valid subject name"<<pos; break; } } cout<<"\nNumber of the teacher:"; cout<<n; for(int i=0;i<n;i++) { if(strcmp(tnam,Tname[pos])) x=1; if(x==0) {finout.write((char*)&T,sizeof(Teacher)); } } } finout.close(); finout.close(); } */ class Time //class to get timing { private: float hh,mm,Time2; //variables to get hour,minute,durationof time int nperiod; //to get no of periiod public : void Timing(); //to get timming void Distime(); //to dislay suchedule of the school void Modify(); //to changed old information }Ti; void Time::Timing() //defination of time func() { clrscr(); cout<<"Enter The Strating time of the school:"; cin>>hh>>mm; cout<<"Enter The duration of the period :"; cin>>Time2; cout<<"Enter the number of the period :"; cin>>nperiod; } void Time::Distime() //to dispaly time { clrscr(); cout<<"Starting Time :"<<hh<<":"<<mm; mm=mm+20; if(mm>=60) { mm=mm-60; hh++; } cout<<"\nPray Time:"<<hh<<":"<<mm; for(int i=0;i<nperiod;i++) { mm=mm+Time2; if(mm>=60) { mm=mm-60; hh++; } if(hh>12) hh=hh-12; cout<<"\nPeriod "<<i+1<<":"<<hh<<":"<<mm; } } void Time::Modify() //to changed the time { int hh1=0,mm1=0,time2,nper;//variales to store changed time

char ch; finout.open("TIME",ios::ate|ios::in|ios::out);//to open file TIME { finout.seekg(0,ios::beg); //to put the file pointer at beg ning finout.read((char*)&Ti,sizeof(Time)); //to read from file Ti.Distime(); //to display old timming of the school } cout<<"\n Want to Modify\n"; cin>>ch; if(ch=='y'||ch=='Y') { cout<<"\t\t\t\t \n"; cout<<"Enter The Strating time of the school:"; cin>>hh1>>mm1; cout<<"Enter The duration of the period :"; cin>>time2; cout<<"Enter the number of the period :"; cin>>nper; hh=hh1; mm=mm1; Time2=time2; nperiod=nper; finout.seekp(0,ios::beg); finout.write((char*)&Ti,sizeof(Time));//to write to the file } finout .close(); //to close the file } struct subject //structure to store subject teacher { char sub_tea[20]; //array of suject teacher }; struct Class //structure to store information about the class { int n_class; //to store no of class in the school int t_stu; //to store total student of the class int t_boy; //to store total boys of the class int t_girl; //to store total girl of the class char c_teacher[20]; //to store class teacher name char b_mon[20]; //to store class boys monitor name char g_mon[20]; //to store class girls monitor name subject sub[20]; //variable of the subject structure } ; Class C[50]; //array of variables int nclass; void Getdata(int A); //to get information of the class void Display(int); //to dispaly information of the class void Search(int); //to search class void Modify(); //to modify class void Delete(); //to delete class char *sub[]={ "Hindi Teacher", //pointer "English Teacher", "Maths Teacher" , "Science Teacher", "S.S Teacher", "I.T Teacher" }; char *subj[]={ "Hindi Teacher", //pointer "English Teacher", "Maths Teacher" , "Physics Teacher", "Sanskrit Teacher", "Chemstry Teacher",

"Biology Teacher", "Geography Teacher", "Computer Science Teacher" , "Accontancy Teacher", "Economics Teacher", "Poltical science Teacher" }; class Record //to store the record of the school in board examination { private : int year,nooften,nooftwe,toptenmar[1][6], //variables to store toptwemar[1][10]; //record float tentop,twetop; char toptennam[20],toptwenam[20],subject[6][25],//variables to store subtoptwe[10][25]; //Tooper name public : void Getrecd(); //to get the record void Search(); //to serachthe record }R; void Record ::Getrecd() //defination of functionGetrecord { cout<<"\nEnter year\n"; cin>>year; cout<<"\nEnter no:of students appeared in tenth\n"; cin>>nooften; cout<<"\nTenth topper's name\n"; gets(toptennam); cout<<"\nPercentage\n"; cin>>tentop; cout<<"\nSubject wise topper's name (eng,maths,sci,hindi,ss,it)\n"; for(int i=0;i<6;i++) { gets(subject[i]); } cout<<"\n Enter their marks's in same series\n"; for(i=0;i<1;i++) { for(int j=0;j<6;j++) cin>>toptenmar[i][j]; } cout<<"\nEnter no:of students appeared in Tweleth\n"; cin>>nooftwe; cout<<"\nTweleth topper's name\n"; gets(toptwenam); cout<<"\nTopper Percentage\n"; cin>>twetop; cout<<"\nSubject wise topper's name \n"; cout<<"(Sans,Eng,Maths,Che,Geo,Bio,Acc,Hindi,Phy,Comp.sci.)\n"; for(i=0;i<10;i++) { gets(subtoptwe[i]); } cout<<"\n Enter their marks's in same series\n"; for(i=0;i<1;i++) { for(int j=0;j<10;j++) cin>>toptwemar[i][j]; } } void Record ::Search() //Defination of the search Func() { finout.open("RECORD.DAT",ios::in|ios::binary);//To open file RECORD.DAT if(finout==NULL) { cout<<"\nFile does not exit"; return; } while(finout.read((char*)&R,sizeof(Record))) //to read from the file { cout<<"\nYear\n"; cout<<year;

cout<<"\nNo:of students appeared in tenth\n"; cout<<nooften; cout<<"\nTenth toppr's name\n"; puts(toptennam); cout<<"\nTopper percentage\n"; cout<<tentop; cout<<"\nSubject wise topper,s name (eng,maths,sci,hindi,ss,it)\n"; for(int i=0;i<6;i++) { puts(subject[i]); } cout<<"\ntheir name's in same series\n"; for(i=0;i<1;i++) { for(int j=0;j<6;j++) cout<<"\n"<<toptenmar[i][j]; } cout<<"\nNo:of students appeared in tweleth\n"; cout<<nooftwe; cout<<"\nTweleth topper's name\n"; puts(toptwenam); cout<<"\nTopper percentage\n"; cout<<twetop; cout<<"\nSubject wise topper's name \n"; cout<<"(Sans,Eng,Maths,Che,Geo,Bio,Acc,Hindi,Phy,Comp.sci.)\n"; for(i=0;i<10;i++) { puts(subtoptwe[i]); } cout<<"\nTheir marks's in same series\n"; for(i=0;i<1;i++) { for(int j=0;j<10;j++) cout<<"\n"<<toptwemar[i][j]; } //to close the file } struct Building //Structure contain Information about the Building { int room; //to store no of Room in the school char Cl_name[20]; //to store the class name }B[100]; //variables of structure int no_room; void Getrno(int x); //to get the total room in the school void Modify_rno(); //to Change the room of the class struct Fees //struct fee contains Fees of deefirent class { char cl_nam[20]; //to store class name char fee[20]; //to store the fees char fine[20]; //to store the fine char re_adm[20]; //to store the admmision fees char l_date[10]; //to store last date of submmision of fees char *Month[]; //pointer of month }F[100]; //array variables of structure Fees int tclass; char *Month[]={ "Apr", //pointer "May", "Jun" , "July", "Aug", "Sep", "Oct", "Nov", "Dec" , "Jan", } finout.close();

"Feb", "Mar" }; void Getfee(int); //to get the fees void Disfee(int); //to display the fees void Modify_fee(); //to modify in the fees void Search_fee(int);//to Serach of the class int main(void) //main started { clrscr(); int choice1,choice2; //to store the choice for the desired mode cout<<" \n\n\n\n\t\t ====================================="; cout<<" \n\t\t MENU "; cout<<" \n \t\t ====================================="; cout<<"\n\n\t\t 1.ENTER MODE"<<endl; cout<<" \t\t 2.DISPALY MODE"<<endl; cout<<" \t\t 3.MODIFLY"<<endl; cout<<" \t\t 4.SEARCH"<<endl; cout<<" \t\t 5.DELETE"<<endl; cout<<" \t\t 6.EXIT"<<endl; cout<<"\t\t Enter your chioce(1-6):"; cin>>choice1; //to get the desired mode switch(choice1) { case 1: clrscr(); cout<<"\n\n\n\t\t\t==================="; cout<<"\n\t\t\t SCHOOL "; cout<<"\n\t\t\t===================\n"; cout<<"\t\t\t1.ABOUT SCHOOL."<<endl; cout<<"\t\t\t2.TEACHER."<<endl; cout<<"\t\t\t3.TIMING."<<endl; cout<<"\t\t\t4.ClASS."<<endl; cout<<"\t\t\t5.RECORD."<<endl; cout<<"\t\t\t6.FEES."<<endl; cout<<"\t\t\t7.BUILDING."<<endl; cout<<"\t\t\t8.EXIT."<<endl; cout<<"\t\t\tEnter your choice..(1-8)"; cin>>choice2; //to get the differnt option switch(choice2) { case 1: finout.open("S",ios::app|ios::binary|ios::out|ios::in); S.Getentry(); //calling finout.seekp(0,ios::beg);//to put pointer at begning finout.write((char*)&S,sizeof(School));//write to the cla ss finout.close();//to close the file break; case 2: finout.open("T",ios::app|ios::binary|ios::out|ios::in); T.Getdata(); finout.seekp(0,ios::beg); finout.write((char*)&T,sizeof(Teacher)); finout.close(); break; case 3: finout.open("TIME",ios::app|ios::binary|ios::out|ios::in) ; Ti.Timing(); finout.seekp(0,ios::beg); finout.write((char*)&Ti,sizeof(Time)); finout.close(); break; case 4: clrscr(); int _class; cout<<"How many class are there in your school";

cin>>nclass; Getdata(nclass); finout.open("CLASS",ios::app|ios::binary|ios::out|ios::in ); finout.seekp(0,ios::beg); finout.write((char*)&C,sizeof(Class)); finout.close(); break; case 5: finout.open("RECORD.DAT",ios::app|ios::binary|ios::out|io s::in); { R.Getrecd(); finout.seekp(0,ios::beg); finout.write((char*)&R,sizeof(Record)); } finout.close(); break; case 6: clrscr(); finout.open("FEES",ios::app|ios::binary|ios::out|ios::in) ; cout<<"Enter total class"; cin>>tclass; Getfee(tclass); finout.seekp(0,ios::beg); finout.write((char*)&F,sizeof(Fees)); finout.close(); break; case 7: clrscr(); cout<<"Enter total room in the school"; cin>>no_room; Getrno(no_room); finout.open("BUILDING",ios::app|ios::binary|ios::out|ios: :in); finout.seekp(0,ios::beg); finout.write((char*)&B,sizeof(Building)); finout.close(); break; case 8: break; default: clrscr(); cout<<"\n\n\n\n\n" "n\n\n\n\n\n\n\n\t\t\tWrong choice!!!\n"; break; } break; case 2: clrscr(); cout<<"\n\n\n\t\t\t==================="; cout<<"\n\t\t\t DISPALY MODE "; cout<<"\n\t\t\t===================\n"; cout<<"\t\t\t1.ABOUT SCHOOL."<<endl; cout<<"\t\t\t2.TEACHER."<<endl; cout<<"\t\t\t3.TIMING."<<endl; cout<<"\t\t\t4.ClASS."<<endl; cout<<"\t\t\t5.FEES."<<endl; cout<<"\t\t\t6.EXIT."<<endl; cout<<"\t\t\tEnter your choice..(1-6)"; cin>>choice2; switch(choice2) { case 1: finout.open("S",ios::in); { finout.seekg(0,ios::beg); finout.read((char*)&S,sizeof(School)); S.Disschool();

case

case

case

case

case

} break; 2: finout.open("T",ios::in); { finout.seekg(0,ios::beg); finout.read((char*)&T,sizeof(Teacher)); T.Distea(); } break; 3:finout.open("TIME",ios::in); { finout.seekg(0,ios::beg); finout.read((char*)&Ti,sizeof(Time)); Ti.Distime(); } break; 4: int _class; char ch; finout.open("CLASS",ios::in); finout.seekg(0,ios::beg); finout.read((char*)&C,sizeof(Class)); do { cout<<"Enter the class whose information" <<"is to be displayed:"; cin>>_class; int flag=0; for(int i=0;i<nclass;i++) { if(C[i].n_class==_class) Display(i); flag=1; break; } if(!flag) cout<<"Wrong choice"; cout<<"\n"<<"Enter the right choice(y/n)"; cin>>ch; } while(ch=='y'); finout.close(); break; 5: char fclass[20]; finout.open("FEE",ios::in); finout.seekg(0,ios::beg); finout.read((char*)&F,sizeof(Fees)); do { cout<<"Enter the class whose Fee" <<"is to be displayed:"; cin>>fclass; int flag=0; for(int i=0;i<tclass;i++) { if(strcmp(F[i].cl_nam,fclass)) Disfee(i); flag=1; break; } if(!flag) cout<<"Wrong choice"; cout<<"\n"<<"Enter the right choice(y/n)"; cin>>ch; } while(ch=='y'); finout.close(); break; 6: break;

default:cout<<"Wrong chioce"; } break; case 3: clrscr(); cout<<"\n\n\n\t\t\t==================="; cout<<"\n\t\t\t MODIFY "; cout<<"\n\t\t\t===================\n"; cout<<"\t\t\t1.ABOUT SCHOOL."<<endl; cout<<"\t\t\t2.TEACHER."<<endl; cout<<"\t\t\t3.TIMING."<<endl; cout<<"\t\t\t4.ClASS."<<endl; cout<<"\t\t\t5.FEES."<<endl; cout<<"\t\t\t6.BUILDING."<<endl; cout<<"\t\t\t7.EXIT."<<endl; cout<<"\t\t\tEnter your choice..(1-7)"; cin>>choice2; switch(choice2) { case 1: S.Modify(); break; case 2: //T.Modify(); break; case 3: Ti.Modify(); break; case 4: Modify(); break; case 5: Modify_fee(); break; case 6: Modify_rno(); break; case 7: break; default:cout<<"Wrong chioce"; } break; case 4: clrscr(); cout<<"\n\n\n\t\t\t==================="; cout<<"\n\t\t\t SEARCH "; cout<<"\n\t\t\t===================\n"; cout<<"\t\t\t1.TEACHER."<<endl; cout<<"\t\t\t2.ClASS."<<endl; cout<<"\t\t\t3.RECORD."<<endl; cout<<"\t\t\t4.FEES."<<endl; cout<<"\t\t\t5.BUILDING."<<endl; cout<<"\t\t\t6.EXIT."<<endl; cout<<"\t\t\tEnter your choice..(1-6)"; cin>>choice2; switch(choice2) { case 1: //T.Search(); break; case 2: int c1; cout<<"Which class you want to search"; cin>>c1; Search(c1); break; case 3: R.Search(); break; case 4: char Sear_cls[20]; char ch; finout.open("FEE",ios::in); finout.seekg(0,ios::beg); finout.read((char*)&F,sizeof(Fees));

do { cout<<"Enter the class whose Fee" <<"is to be displayed:"; gets(Sear_cls); int flag=0; for(int i=0;i<tclass;i++) { if(strcmp(F[i].cl_nam,Sear_cls)) Search_fee(i); flag=1; break; } if(!flag) cout<<"Wrong choice"; cout<<"\n"<<"Enter the right choice(y/n)"; cin>>ch; } while(ch=='y'); finout.close(); break; case 5: char Sear_class[20]; char ch1; finout.open("BUILDING",ios::in); do { cout<<"Enter the class whose Room no" <<"is to be displayed:"; gets(Sear_class); int flag=0; for(int i=0;i<no_room;i++) { if(strcmp(B[i].Cl_name,Sear_class)) cout<<"Room is"<<i; flag=1; break; } if(!flag) cout<<"Wrong choice"; cout<<"\n"<<"Enter the right choice(y/n)"; cin>>ch1; } while(ch1=='y'); break; case 6:break; default:cout<<"Wrong chioce"; } break; case 5: clrscr(); cout<<"\n\n\n\t\t\t==================="; cout<<"\n\t\t\t DELETE "; cout<<"\n\t\t\t===================\n"; cout<<"\t\t\t1.TEACHER."<<endl; cout<<"\t\t\t2.ClASS."<<endl; cout<<"\t\t\t3.EXIT."<<endl; cout<<"\t\t\tEnter your choice..(1-3)"; cin>>choice2; switch(choice2) { case 1://T.Delete(); break; case 2: Delete(); break; case 4: break; default:cout<<"Wrong chioce"; } break;

case 6: clrscr(); cout<<"\n\n\n\t\t\t======================================="; cout<<"\n\t\t\t|| ||"; cout<<"\n\t\t\t|| A ||"; cout<<"\n\t\t\t|| COMPUTER PROJECT ||"; cout<<"\n\t\t\t|| BY ||"; cout<<"\n\t\t\t|| YOGESH CHANDOLIA ||"; cout<<"\n\t\t\t|| & ||"; cout<<"\n\t\t\t|| VINAYAK JOSHI ||"; cout<<"\n\t\t\t|| ||"; cout<<"\n\t\t\t|| ||"; cout<<"\n\t\t\t|| ||"; cout<<"\n\t\t\t|| ||"; cout<<"\n\t\t\t=======================================\n\n\t\t"; break; default: cout<<"Wrongh choice "; } _dos_getdate(&d); gotoxy(0,0); printf("Date: %d/", d.day); printf(" %d/", d.month); printf(" %d",d.year); gettime(&t); gotoxy(0,15); printf("Time:%d:",t.ti_hour); printf(" %d:", t.ti_min); printf(" %d", t.ti_sec); t.ti_min++; settime(&t); getch(); return 0; } void Getdata(int size) //defination of the Getdata { char x; cout<<"\t\tEnter Mode"; for(int i=0;i<size;i++) { cout<<"Class:"; cin>>C[i].n_class; cout<<"\n"<<"Enter Total Student:"; cin>>C[i].t_stu; do { cout<<"\n"<<"BOYS:"; cin>>C[i].t_boy; cout<<"\n"<<"GIRLS:"; cin>>C[i].t_girl; if(C[i].t_stu!=C[i].t_boy+C[i].t_girl) continue; }while(C[i].t_stu!=(C[i].t_boy+C[i].t_girl)); cout<<"\n"<<"Class Teacher:"; gets(C[i].c_teacher); if(C[i].n_class<=10) { cout<<"\nEnter Subject Teacher"; for(int j=0;j<6;j++) { puts(sub[j]); gets(C[i].sub[j].sub_tea); } } else { cout<<"\nEnter Subject Teacher"; for(int j=0;j<10;j++)

{ puts(subj[j]); gets(C[i].sub[j].sub_tea); } } cout<<"\n"<<"Boys Monitor:"; gets(C[i].b_mon); cout<<"\n"<<"Girl Monitor:"; gets(C[i].g_mon); cout<<"\n"; cout<<"Want to enter more(y/n)" ; cin>>x; if(x=='y') break; } } void Display(int a) //defination of the Display func() { cout<<"\n"<<" Total Student:"<<C[a].t_stu; cout<<"\n"<<"BOYS:"<<C[a].t_boy; cout<<"\n"<<"GIRLS:"<<C[a].t_girl; cout<<"\n"<<"Class Teacher:"; puts(C[a].c_teacher); if(a<=10) {for(int j=0;j<6;j++) { puts(sub[j]); puts(C[a].sub[j].sub_tea); } } else {for(int j=0;j<6;j++) { puts(subj[j]); puts(C[a].sub[j].sub_tea); } } cout<<"\n"<<"Boys Monitor:"; puts(C[a].b_mon); cout<<"\n"<<"Girl Monitor:"; puts(C[a].g_mon); cout<<"\n"; } void Modify() //definationof the ModifyFunc() { char ch; //variables to store changed values int x,y,j; int _class,c_lass; int _stu; int _boy; int _girl; char _teacher[20]; char _mon[20]; char _moni[20]; char s_tea[20]; finout.open("CLASS",ios::ate|ios::in|ios::out); { finout.seekg(0,ios::beg); finout.read((char*)&C,sizeof(Class)); cout<<"Which class want to modify"; cin>>c_lass; for(int i=0;i<nclass;i++) { if(C[i].n_class==c_lass) y=i; Display(i); break;

} } cout<<"\n Want to Modify\n"; cin>>ch; if(ch=='y'||ch=='Y') { cout<<"Class:"; cin>>_class; cout<<"\n"<<"Enter Total Student:"; cin>>_stu; do { cout<<"\n"<<"BOYS:"; cin>>_boy; cout<<"\n"<<"GIRLS:"; cin>>_girl; if(_stu!=_boy+_girl) continue; } while(_stu!=(_boy+_girl)); cout<<"\n"<<"Class Teacher:"; gets(_teacher); cout<<"\nEnter Subject Teacher"; for(int j=0;j<6;j++) { puts(sub[j]); gets(s_tea); } cout<<"\n"<<"Boys Monitor:"; gets(_mon); cout<<"\n"<<"Girl Monitor:"; gets(_moni); cout<<"\n"; cout<<"Want to enter more(y/n)" ; cin>>x; } strcpy(C[y].c_teacher,_teacher); strcpy(C[y].sub[j].sub_tea,s_tea); strcpy(C[y].b_mon,_mon); strcpy(C[y].g_mon,_moni); C[y].n_class=_class; C[y].t_stu=_stu; C[y].t_boy=_boy; C[y].t_girl=_girl; finout.seekp(0,ios::beg); finout.write((char*)&C,sizeof(Class)); finout.close(); } void Search(int a) //defination of Search func() { clrscr(); finout.open("CLASS",ios::in|ios::binary); if(finout==NULL) { cout<<"\n File does not Exit"; return; } while(finout.read((char*)&C,sizeof(Class))) { cout<<"\n"<<" Total Student:"<<C[a].t_stu; cout<<"\n"<<"BOYS:"<<C[a].t_boy; cout<<"\n"<<"GIRLS:"<<C[a].t_girl; cout<<"\n"<<"Class Teacher:"; puts(C[a].c_teacher); for(int j=0;j<5;j++) { puts(sub[j]);

puts(C[a].sub[j].sub_tea); } cout<<"\n"<<"Boys Monitor:"; puts(C[a].b_mon); cout<<"\n"<<"Girl Monitor:"; puts(C[a].g_mon); cout<<"\n"; } finout.close(); } void Delete() //defination of Delete func() { clrscr(); int flag=0; int Delclass; cout<<"Enter class to be deleted \n"; cin>>Delclass; finout.open("CLASS",ios::in); if(finout==NULL) { cout<<"\n file does not Exit"; return; } finout.open("temp",ios::app|ios::out); while(finout.read((char*)&C,sizeof(Class))) { for(int i=0;i<nclass;i++) { if(Delclass!=C[i].n_class) finout.write((char*)&T,sizeof(Teacher)); else flag=1; } } if(flag==0) cout<<"\n Class does not Exit"; else cout<<"Class Deleted"; finout.close(); finout.close(); remove("CLASS"); rename("temp","CLASS"); } void Getrno(int size) //defination of Getrno func() { for(int i=1;i<=size;i++) { B[i].room=i; cout<<"Enter the class in Room "<<B[i].room; gets(B[i].Cl_name); } } void Modify_rno() //defination of Modify_rno func() { int mrno; char ch,Mod_class[20]; finout.open("BUILDING",ios::ate|ios::in|ios::out); { finout.seekg(0,ios::beg); finout.read((char*)&B,sizeof(Building)); cout<<"Enter the class whose Room no" <<"is to be changed:"; gets(Mod_class); int flag=0; for(int i=0;i<no_room;i++) { if(strcmp(B[i].Cl_name,Mod_class)) cout<<"Room is"<<i;

cout<<"\n Want to Modify\n"; cin>>ch; if(ch=='y'||ch=='Y') { cout<<"\t\t\t\t \n"; cout<<"Enter the room for the class"; cin>>mrno; } B[i].room=mrno; flag=1; break; } if(!flag) cout<<"Wrong choice"; cout<<"\n"<<"Enter the right choice(y/n)"; cin>>ch; }while(ch=='y'); finout.seekp(0,ios::beg); finout.write((char*)&B,sizeof(Building)); finout.close(); } void Getfee(int size) //defination of Getfee func() { for(int i=0;i<size;i++) { cout<<"Enter the class"; gets(F[i].cl_nam); cout<<"Enter the fees:\n"; for(int j=0;j<11;j++) { puts(Month[j]); gets(F[i].fee); cout<<"Enter last date of fee submmision"; gets(F[i].l_date); } cout<<"Re-Admmission fees"; gets(F[i].re_adm); cout<<"Enter fine "; gets(F[i].fine); } } void Disfee(int a) //defination of Disfee func() { cout<<"Monthly Fees:\n"; for(int j=0;j<11;j++) { puts(Month[j]); puts(F[a].fee); cout<<"Last date of fee submmision"; puts(F[a].l_date); } cout<<"Re-Admmission fees"; puts(F[a].re_adm); cout<<"Fine "; puts(F[a].fine); } void Modify_fee() //defination of Modify_fee func() { int y; char ch,mfclass[20],fees[20],lastdate[20],readm[10],fin[10]; finout.open("FEE",ios::ate|ios::in|ios::out); { finout.seekg(0,ios::beg); finout.read((char*)&F,sizeof(Fees)); cout<<"Which class want to modify"; cin>>mfclass; for(int i=0;i<tclass;i++) { if(F[i].cl_nam==mfclass)

y=i; Disfee(i); break; } } cout<<"\n Want to Modify\n"; cin>>ch; if(ch=='y'||ch=='Y') { cout<<"Enter the fees:\n"; for(int j=0;j<11;j++) { puts(Month[j]); gets(fees); cout<<"Enter last date of fee submmision"; gets(lastdate); } cout<<"Re-Admmission fees"; gets(readm); cout<<"Enter fine "; gets(fin); } strcpy(F[y].fee,fees); strcpy(F[y].l_date,lastdate); strcpy(F[y].re_adm,readm); strcpy(F[y].fine,fin); } void Search_fee(int a) //defination of Search _fee func() { clrscr(); finout.open("FEE",ios::in|ios::binary); if(finout==NULL) { cout<<"\n File does not Exit"; return; } while(finout.read((char*)&F,sizeof(Fees))) {cout<<"Monthly Fees:\n"; for(int j=0;j<11;j++) { puts(Month[j]); puts(F[a].fee); cout<<"Last date of fee submmision"; puts(F[a].l_date); } cout<<"Re-Admmission fees"; puts(F[a].re_adm); cout<<"Fine "; puts(F[a].fine); } }

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