strcat(fn,s[i].name); strcat(fn,".txt"); file.open(fn,ios::out); if(!file) { gotoxy(25,79); cout<<"."; } file<<" Report Card Of "<<s[i].name <<"\nRegistration Number:"<<s[i].redgno<<"\nClass:"<<s[i].clas <<"\nAddress:"<<s[i].address<<"\nFather's Name:"<<s[i].fname <<"\nDate Of Birth:"<<s[i].dob.dd<<"-"<<s[i].dob.mm<<"-"<<s[i].dob.yyyy <<"\nStream:"<<s[i].st_code<<"\n\n\ ------------------------------------------------------------------------------\ \nSubject Marks\n-------------\nSubject 1 :" <<s[i].sub1<<"\nSubject 2 :"<<s[i].sub2<<"\nSubject 3 :"<<s[i].sub3 <<"\nSubject 4 :"<<s[i].sub4<<"\nSubject 5 :"<<s[i].sub5 <<"\nTotal :"<<s[i].total<<"\nGrade :"<<s[i].div; file.close(); i++; gotoxy(10,22); cout<<"Want More Record To Be Written?(Y/N)......"; cin>>ch; }while(ch=='y'||ch=='Y'); if(ch=='n'||ch=='N') student_menu(); } /******************************Function To Modify Marks**********************/ void mod() { int regno,flag=0,i; char ch; student te; clrscr(); cout<<"\n\nEnter The Reg No to be modified:"; cin>>regno; for(i=0;i<10;i++) { if(s[i].redgno==regno) { flag=1; cout<<"\nSubject 1 :"<<s[i].sub1; cout<<"\nDo you want to change this?[y/n]"; ch=getch(); if(ch=='y') { Page 10
Students Infomation System.cpp
cout<<"\nEnter New Value:"; cin>>te.sub1; s[i].sub1=te.sub1; } cout<<"\nSubject 2 :"<<s[i].sub2; cout<<"\nDo you want to change this?[y/n]"; ch=getch(); if(ch=='y') { cout<<"\nEnter New Value:"; cin>>te.sub2; s[i].sub2=te.sub2; } cout<<"\nSubject 3 :"<<s[i].sub3; cout<<"\nDo you want to change this?[y/n]"; ch=getch(); if(ch=='y') { cout<<"\nEnter New Value:"; cin>>te.sub3; s[i].sub3=te.sub3; } cout<<"\nSubject 4 :"<<s[i].sub4; cout<<"\nDo you want to change this?[y/n]"; ch=getch(); if(ch=='y') { cout<<"\nEnter New Value:"; cin>>te.sub4; s[i].sub4=te.sub4; } cout<<"\nSubject 5 :"<<s[i].sub5; cout<<"\nDo you want to change this?[y/n]"; ch=getch(); if(ch=='y') { cout<<"\nEnter New Value:"; cin>>te.sub5; s[i].sub5=te.sub5; } } } if(flag==0) cout<<"Invalid Reg No!"; } /****************************Function To View Help***************************/ void help() { //clrscr(); textcolor(WHITE); message(12,8,6,"This Software is designed for aiding schools in", Page 11
Students Infomation System.cpp
"keeping records of students and thier information.", "This software is a interactive menu driven program.", "This program will create a file with students name ", "with all his infomation","OK",LIGHTGRAY); gotoxy(15,14); textcolor(WHITE); textbackground(LIGHTGRAY); cputs(" Keys:-Up,-Down,Enter-Selecting,Esc-To Exit."); getch(); textcolor(BLACK); main_menu(); } /************************Function To Show Credits****************************/ void updown() { int i; textcolor(GREEN); for (i=25;i>10;i--) { delay(180); clrscr(); gotoxy(30,i); cputs("PROGRAMERS"); gotoxy(30,i+2); cputs("Lohit Chandran"); gotoxy(30,3+i); cputs("Sreenath S"); gotoxy(30,4+i); cputs("Binny V Abraham"); gotoxy(30,5+i); cputs(" "); } delay(800); clrscr(); for (i=25;i>10;i--) { delay(180); clrscr(); gotoxy(30,i); cputs("Special Effects By"); gotoxy(30,2+i); cputs("Sreenath S"); gotoxy(30,3+i); cputs("Binny V Abraham"); gotoxy(30,4+i); cputs(" "); } delay(800); clrscr(); for (i=25;i>10;i--) Page 12
Students Infomation System.cpp
{ delay(180); clrscr(); gotoxy(30,i); cputs("Special Thanks To"); gotoxy(30,2+i); cputs("Priya Miss"); gotoxy(30,3+i); cputs(""); gotoxy(30,4+i); cputs(" "); } delay(800); clrscr(); for (i=25;i>10;i--) { delay(180); clrscr(); gotoxy(30,i); cputs("Developed At"); gotoxy(30,2+i); cputs("Campion Computer Laboratory"); gotoxy(30,4+i); cputs(" "); } delay(800); clrscr(); for (i=25;i>10;i--) { delay(180); clrscr(); textcolor(RED+BLINK); gotoxy(10,i); cputs(" WARNING!!"); textcolor(BLUE); gotoxy(10,1+i); cputs(" This program is protected by copyright laws"); gotoxy(10,2+i); cputs(" and International Treaties"); gotoxy(10,4+i); cputs("Illigal Copying or reproduction of this software is punishable "); gotoxy(10,5+i); cputs(" and is against the protocol "); } delay(3000); } /***********************Function To Initialize Graphics**********************/ void graph() { Page 13
Students Infomation System.cpp
int graphdriver = DETECT, graphmode; initgraph(&graphdriver, &graphmode, ""); } /****************************Function To Make Menus**************************/ int menu(int xi,int y,int num,char a[25],char b[25],char c[25],char d[25],char e[25],char sl1[2],char sl2[2],char title[40],char under[2]) { char ch; int key,x=4,sl=1,l,i; clrscr(); l=strlen(title); gotoxy(xi,y-2); cout<<title; cout<<"\n"; gotoxy(xi,y-1); for(i=0;i<l;i++) cout<<under; gotoxy(xi,y); cout<<sl1<<a<<sl2; gotoxy(xi,y+1); cout<<" "<<b; gotoxy(xi,y+2); cout<<" "<<c; gotoxy(xi,y+3); cout<<" "<<d; gotoxy(xi,y+4); cout<<" "<<e; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:1"; key=bioskey(0); while (key!=7181) { switch(key) { case 18432: clrscr(); //UP l=strlen(title); gotoxy(xi,y-2); cout<<title; cout<<"\n"; gotoxy(xi,y-1); for(i=0;i<l;i++) cout<<under; switch(x) { case 4: if (num==4) goto up4; else if (num==3) goto up3; else if (num==2) goto up2; gotoxy(xi,y); cout<<" "<<a; gotoxy(xi,y+1); Page 14
Students Infomation System.cpp
cout<<" "<<b; gotoxy(xi,y+2); cout<<" "<<c; gotoxy(xi,y+3); cout<<" "<<d; gotoxy(xi,y+4); cout<<sl1<<e<<sl2; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:5";sl=5; if (num==5) x=2; else x=1; break; case 2: up4: gotoxy(xi,y); cout<<" "<<a; gotoxy(xi,y+1); cout<<" "<<b; gotoxy(xi,y+2); cout<<" "<<c; gotoxy(xi,y+3); cout<<sl1<<d<<sl2; gotoxy(xi,y+4); cout<<" "<<e; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:4";sl=4; if (num==5) x=3; else if (num==4) x=3; else x=1; break; case 3: up3: gotoxy(xi,y); cout<<" "<<a; gotoxy(xi,y+1); cout<<" "<<b; gotoxy(xi,y+2); cout<<sl1<<c<<sl2; gotoxy(xi,y+3); cout<<" "<<d; gotoxy(xi,y+4); cout<<" "<<e<<" "; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:3";sl=3; x=1; break; case 1: up2: gotoxy(xi,y); cout<<" "<<a; gotoxy(xi,y+1); cout<<sl1<<b<<sl2; gotoxy(xi,y+2); cout<<" "<<c; gotoxy(xi,y+3); Page 15
Students Infomation System.cpp
cout<<" "<<d; gotoxy(xi,y+4); cout<<" "<<e; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:2";sl=2; if (num==5) x=5; else if (num==2) x=5; else x=5; break; case 5: gotoxy(xi,y); cout<<sl1<<a<<sl2; gotoxy(xi,y+1); cout<<" "<<b; gotoxy(xi,y+2); cout<<" "<<c; gotoxy(xi,y+3); cout<<" "<<d; gotoxy(xi,y+4); cout<<" "<<e; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:1";sl=1; if (num==5) x=4; else if (num==2) x=1; else if (num==3) x=3; else if (num==4) x=2; break; default:cout<<"Wrong!!2"<<x;getch();exit(0); } break; case 20480: clrscr(); l=strlen(title); gotoxy(xi,y-2); cout<<title; cout<<"\n"; gotoxy(xi,y-1); for(i=0;i<l;i++) cout<<under; switch(x) { case 1: gotoxy(xi,y); cout<<" "<<a<<"\n" <<" "<<b<<"\n" <<" "<<c<<" \n" <<" "<<d<<" \n" <<sl1<<e<<sl2; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:5";sl=5; x=5; break; case 2: gotoxy(xi,y); cout<<" "<<a<<"\n" <<" "<<b<<"\n" Page 16
//DOWN
Students Infomation System.cpp
<<" "<<c<<" \n" <<sl1<<d<<sl2 <<"\n "<<e<<" \n"; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:4";sl=4; if (num==4) x=5; else x=1; break; case 3: gotoxy(xi,y); cout<<" "<<a<<"\n" <<" "<<b<<"\n" <<sl1<<c<<sl2 <<"\n "<<d<<" \n" <<" "<<e<<" "; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:3";sl=3; if (num==5) x=2; else if (num==3) x=5; else x=2; break; case 4: gotoxy(xi,y); cout<<" "<<a<<"\n" <<sl1<<b<<sl2 <<"\n "<<c<<" \n" <<" "<<d<<" \n" <<" "<<e<<" \n"; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:2";sl=2; if (num==5) x=3; else if (num==2) x=5; else x=3; break; case 5: gotoxy(xi,y); cout<<sl1<<a<<sl2 <<"\n "<<b<<"\n" <<" "<<c<<" \n" <<" "<<d<<" \n" <<" "<<e<<" \n"; gotoxy(xi,y+num+1); cout<<"Enter Your Choice:1";sl=1; if (num==5) x=4; else if (num==2) x=4; else x=4; break; default:cout<<"Wrong!!2"<<x;getch();exit(0); } break; case 283:sl=6; goto end; case 561:sl=1;goto end; case 818:sl=2;goto end; case 1075:sl=3;goto end; case 1332:sl=4;goto end; Page 17
Students Infomation System.cpp
case 1589:sl=5;goto end; case 1846:sl=6;goto end; case 7181:goto end; default:break; } key=bioskey(0); } end: return sl; } /***********************************Final Screen*****************************/ void man() { int d=DETECT,m,i; initgraph(&d,&m," "); settextstyle(7,0,7); randomize(); for(i=0;i<5800;i++) putpixel(random(800),random(600),random(15)+1); outtextxy(10,150," See you again!"); getch(); closegraph(); } /*********************************Menus******************************* ******/ /********************************Menu To View Marks**************************/ void view() { int opt,i,reg,flag=0; char n[20],ch; view: opt=menu(1,5,5,"1.View All","2.Search Reg No","3.Show Failers","4.Read From File" ,"5.Back","[","]", "Dispay Menu","="); switch(opt) { case 1: //Show All Marks for(i=0;i<10;i++) { clrscr(); if(s[i].redgno!=NULL) { cout<<" Report Card Of "<<s[i].name <<"\nRegistration Number:"<<s[i].redgno<<"\nClass:"<<s[i].clas <<"\nAddress:"<<s[i].address<<"\nFather's Name:"<<s[i].fname <<"\nDate Of Birth:"<<s[i].dob.dd<<"-"<<s[i].dob.mm<<"-"<<s[i].dob.yyyy <<"\nStream:"<<s[i].st_code<<"\n\n\ Page 18
Students Infomation System.cpp
------------------------------------------------------------------------------\ \nSubject Marks\n-------------\nSubject 1 :" <<s[i].sub1<<"\nSubject 2 :"<<s[i].sub2<<"\nSubject 3 :"<<s[i].sub3 <<"\nSubject 4 :"<<s[i].sub4<<"\nSubject 5 :"<<s[i].sub5 <<"\nTotal :"<<s[i].total<<"\nGrade :"<<s[i].div; cout<<"\n\nPress Any Key To Continue.."; getch(); } else break; } break; case 3:clrscr(); //Show Failers for(i=0;i<records;i++) { if((s[i].sub1<33)||(s[i].sub2<33)||(s[i].sub3<33)||(s[i].sub4<33)||(s[ i].sub5<33)) { cout<<" Report Card Of "<<s[i].name <<"\nRegistration Number:"<<s[i].redgno<<"\nClass:"<<s[i].clas <<"\nAddress:"<<s[i].address<<"\nFather's Name:"<<s[i].fname <<"\nDate Of Birth:"<<s[i].dob.dd<<"-"<<s[i].dob.mm<<"-"<<s[i].dob.yyyy <<"\nStream:"<<s[i].st_code<<"\n\n\ ------------------------------------------------------------------------------\ \nSubject Marks\n-------------\nSubject 1 :" <<s[i].sub1<<"\nSubject 2 :"<<s[i].sub2<<"\nSubject 3 :"<<s[i].sub3 <<"\nSubject 4 :"<<s[i].sub4<<"\nSubject 5 :"<<s[i].sub5 <<"\nTotal :"<<s[i].total<<"\nGrade :"<<s[i].div; cout<<"\n\nPress Any Key To Continue..."; flag=1; getch(); } } if(flag==0) { cout<<"No Failers Found"; getch(); view(); } break; case 2:clrscr(); //Search By Reg No cout<<"\n\n\tEnter Number To Be Searched:";cin>>reg; for(i=0;i<10;i++) { if(s[i].redgno==reg) { cout<<" Report Card Of "<<s[i].name Page 19
Students Infomation System.cpp
<<"\nRegistration Number:"<<s[i].redgno<<"\nClass:"<<s[i].clas <<"\nAddress:"<<s[i].address<<"\nFather's Name:"<<s[i].fname <<"\nDate Of Birth:"<<s[i].dob.dd<<"-"<<s[i].dob.mm<<"-"<<s[i].dob.yyyy <<"\nStream:"<<s[i].st_code<<"\n\n\ ------------------------------------------------------------------------------\ \nSubject Marks\n-------------\nSubject 1 :" <<s[i].sub1<<"\nSubject 2 :"<<s[i].sub2<<"\nSubject 3 :"<<s[i].sub3 <<"\nSubject 4 :"<<s[i].sub4<<"\nSubject 5 :"<<s[i].sub5 <<"\nTotal :"<<s[i].total<<"\nGrade :"<<s[i].div; flag=1; getch(); } } if(flag==0) { cout<<"Record Not Found"; getch(); view(); } break; case 4: //Read File clrscr(); cout<<"\n\n\tEnter Name Of Student:";gets(n); ifstream fil; strcat(n,".txt"); fil.open(n); while(!fil.eof()) { fil.get(ch); cout<<ch; } cout<<"\n\nPress Any Key To Continue..."; getch(); break; case 5:student_menu(); //Exit default:student_menu(); } goto view; } /******************************Student Menu*********************************/ void student_menu() { textbackground(16); textcolor(15); unsigned int tredg; char ch='y',ch1; do Page 20
Students Infomation System.cpp
{ clrscr(); ch1=menu(1,5,3,"1.Add Students","2.Display Student","3.Back","","","[","] " ,"Student Menu","="); switch(ch1) { case 1:clrscr(); //Marks add(); break; case 2:clrscr(); //View Marks view(); break; case 3:main_menu(); //Main Menu getch(); break; case 6:main_menu(); //Main Menu getch(); break; default:cout<<"\n\nWorng Choice!!"; } cout<<"\n\nDo You Want to Continue?(Y/N)"; cin>>ch; } while(ch=='y'||ch=='Y'); main_menu(); } /*********************************Main Menu**********************************/ void main_menu() { textbackground(16); textcolor(LIGHTGRAY); char ch1; do{ clrscr(); ch1=menu(1,5,4,"1. Students Details","2. Modify Students","3. Help","4. Exit" ,""," [","]","Student Information System","="); switch(ch1) { case 1:clrscr(); //Student Menu student_menu(); break; case 2:clrscr(); //Marks Menu mark_menu(); break; case 3:help(); break; case 4:clrscr(); //Exit Page 21
Students Infomation System.cpp
updown(); man(); exit(0); break; case 6:clrscr(); //Exit // updown(); // man(); // exit(0); break; default:cout<<"\n\nWorng Choice!!"; } }while(ch1==4); } /**********************************Marks Menu********************************/ void mark_menu() { textbackground(BLACK); textcolor(WHITE); int t_redg,i,opt,flag=0; char ch='y',na[20]; do { clrscr(); gotoxy(1,25); cout<<"Press Esc to Quit"; opt=menu(1,5,3,"1.Modify Student","2.Remove Student","3.Back", "",""," [","] "," Menu","="); switch(opt) { case 1: clrscr(); //Modify Student mod(); getch(); mark_menu(); break; case 2: clrscr(); //Delete Student cout<<"Which Student Do you want to Delete\nEnter Reg No:"; cin>>t_redg; for(i=0;i<10;i++) { if(s[i].redgno==t_redg) { strcat(na,s[i].name); strcat(na,".txt"); remove(na); cout<<"The Record of "<<s[i].name<<" is removed."; flag=1; break; } } if(flag==0) Page 22