0% found this document useful (0 votes)
67 views

Code 2

This document contains the source code for a C++ student information system. It includes classes for students (std), academics (acd), and functions for adding, displaying, and modifying student and academic records stored in binary files. Key functions include adding a new student record, displaying a student's details, issuing a transfer certificate for a student, and finding the academic toppers of a given class. The code implements a menu-driven console-based interface for interacting with the student information system.

Uploaded by

AdityaChaturvedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

Code 2

This document contains the source code for a C++ student information system. It includes classes for students (std), academics (acd), and functions for adding, displaying, and modifying student and academic records stored in binary files. Key functions include adding a new student record, displaying a student's details, issuing a transfer certificate for a student, and finding the academic toppers of a given class. The code implements a menu-driven console-based interface for interacting with the student information system.

Uploaded by

AdityaChaturvedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 58

STUDENT INFORMATION SYSTEM

source code

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<fstream.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<dos.h>
#include<process.h>
void back()
{
textcolor(15);
textbackground(1);
clrscr();
for ( int i= 0;i<=25;i++)
for ( int j=0;j<80;j++)
{
gotoxy(j,i);

cout<<'';
}
for ( i= 2;i<=24;i++)
for ( j=2;j<=79;j++)
{
gotoxy(j,i);
cout<<' ';
}
}
void back1()
{
textcolor(15);
textbackground(1);
clrscr();
for ( int i= 0;i<=25;i++)
for ( int j=0;j<80;j++)
{
gotoxy(j,i);
cout<<'';
}
for ( i= 7;i<=18;i++)
for ( j=20;j<=65;j++)

{
gotoxy(j,i);
cout<<' ';
}
}

void welcome()
{
textmode(C40);
textcolor(7);
textbackground(1);
clrscr();
_setcursortype(_NOCURSOR);
textcolor(12);
gotoxy(17,2);
clreol();
cout<<"WELCOME";

textcolor(13);

gotoxy(19,8);
clreol();

cout<<"TO";

textcolor(14);

gotoxy(12,13);
clreol();
cout<<"A PROJECT WORK ON";
textcolor(4+128);

gotoxy(7,15);
clreol();
cout<<"STUDENT INFORMATION SYSTEM";

textcolor(6);
gotoxy(20,18);
clreol();
cout<<"DEVELOPED BY :";
textcolor(6);

gotoxy(24,21);

clreol();
cout<<"CHARUAL & MUSKAAN";
textcolor(6);

delay(3000);
getch();

class std
{
char admno[10];
char name[20];
char fname[20];
char mname[20];
char occup[20];
char ph[20];
char dob[15];
char age[5];
char cls[10];
char sec;

char add[40];
public:
char * getadmno()
{
return admno;
}
char * getname()

{
return name;
}
char * getcls()
{
return cls;
}
char getsec()
{
return sec;
}
friend void c_list();
void add_student();
void disp();

void tc();
};

void std::add_student()
{ char x;
clrscr();
back();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(34,6);
textcolor(13);
gotoxy(12,8);
cout<<"ENTER ADMNO

:";

gotoxy(12,9);
cout<<"ENTER NAME

:";

gotoxy(12,10);
cout<<"ENTER FATHER'S NAME:";
gotoxy(12,11);
cout<<"ENTER MOTHER'S NAME:";
gotoxy(12,12);

cout<<"ENTER DATE OF BIRTH:";


gotoxy(12,13);
cout<<"ENTER PH. NO.

:";

gotoxy(12,14);
cout<<"ENTER ADDRESS

:";

gotoxy(12,15);
cout<<"ENTER PRRESENT AGE :";
gotoxy(12,16);
cout<<"ENTER F. OCCUPATION: ";
gotoxy(12,17);
cout<<"ALLOT CLASS

:";

gotoxy(12,18);
cout<<"ALOT SECTION
gotoxy(50,8);
gets(admno);
gotoxy(50,9);
gets(name);
gotoxy(50,10);
gets(fname);
gotoxy(50,11);
gets(mname);
gotoxy(50,12);

:";

gets(dob);
gotoxy(50,13);
gets(ph);
gotoxy(50,14);
gets(add);
gotoxy(50,15);
gets(age);
gotoxy(50,16);
gets(occup);
gotoxy(50,17);
gets(cls);
gotoxy(50,18);
sec=getche();
gotoxy(10,24);
cout<<"DO YOU WANT TO SAVE THE INFORMATION ? (Y/N)
x=getche();

if ( x=='y')
{
ofstream k;
k.open("std.dat",ios::app|ios::binary);
k.write(( char*) this , sizeof(std));

:"

k.close();
gotoxy(10,24);
cout<<"

THE RECORD HAS BEEN SAVED

"

delay(3000);
getch();
}
else
{
gotoxy(10,24);
cout<<"

THE RECORD HAS NOT BEEN SAVED

delay(3000);
}

getch();
}
void std::disp()
{

char p[5];
back();
gotoxy(12,8);
cout<<"ENTER ADMNO TO DISPLAY :";

"

gotoxy(12,60);
gets(p);
int f=0;
clrscr();

ifstream k;
k.open("std.dat",ios::in|ios::binary);
if ( !k)
{
gotoxy(12,13);
cout<<"THE FILE DOES NOT EXIST...";
getch();
return;
}
std x;

while( !k.eof())
{
k.read((char*)&x, sizeof(std));
if ( strcmp(x.admno,p)==0)
{
f=1;

clrscr();
back();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(34,6);
textcolor(13);
gotoxy(12,8);
cout<<"ADMNO

:";

gotoxy(12,9);
cout<<"NAME

:";

gotoxy(12,10);
cout<<"FATHER'S NAME:";
gotoxy(12,11);
cout<<"MOTHER'S NAME:";
gotoxy(12,12);
cout<<"DATE OF BIRTH:";
gotoxy(12,13);
cout<<"PH. NO.

:";

gotoxy(12,14);
cout<<"ADDRESS

:";

gotoxy(12,15);
cout<<"PRRESENT AGE :";
gotoxy(12,16);
cout<<"OCCUPATION: ";
gotoxy(12,17);
cout<<"CLASS

:";

gotoxy(12,18);
cout<<"SECTION
gotoxy(50,8);
cout<<admno;
gotoxy(50,9);
cout<<name;
gotoxy(50,10);
cout<<fname;
gotoxy(50,11);
cout<<mname;
gotoxy(50,12);
cout<<dob;
gotoxy(50,13);
cout<<ph;
gotoxy(50,14);
cout<<add;

:";

gotoxy(50,15);
cout<<age;
gotoxy(50,16);
cout<<occup;
gotoxy(50,17);
cout<<cls;
gotoxy(50,18);
cout<<sec;
gotoxy(10,24);
cout<<"PRESS ANY KEY TO GO BACK ...." ;
getch();
}

}
k.close();
if ( f==0)
{
gotoxy(25,13);
cout<<"ADMISSION NO DOES NOT EXIST ." ;
getch();
}
}

void std::tc()
{

char p[5];
back();
gotoxy(12,8);
cout<<"ENTER ADMNO TO ISSUE TC :";
gotoxy(12,60);
gets(p);
int f=0;
clrscr();

ifstream k;
k.open("std.dat",ios::in|ios::binary);
if ( !k)
{
gotoxy(12,13);
cout<<"THE FILE DOES NOT EXIST...";
getch();
return;
}
std x;

char ch;
ofstream q;
q.open("tmp.dat",ios::out|ios::binary);
while( !k.eof())
{
k.read((char*)&x, sizeof(std));

if ( strcmp(x.admno,p)==0)
{
f=1;
clrscr();
back();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(34,6);
textcolor(13);
gotoxy(12,8);
cout<<"ADMNO
gotoxy(12,9);

:";

cout<<"NAME

:";

gotoxy(12,10);
cout<<"FATHER'S NAME:";
gotoxy(12,11);
cout<<"MOTHER'S NAME:";
gotoxy(12,12);
cout<<"DATE OF BIRTH:";
gotoxy(12,13);
cout<<"PH. NO.

:";

gotoxy(12,14);
cout<<"ADDRESS

:";

gotoxy(12,15);
cout<<"PRRESENT AGE :";
gotoxy(12,16);
cout<<"OCCUPATION: ";
gotoxy(12,17);
cout<<"CLASS

:";

gotoxy(12,18);
cout<<"SECTION
gotoxy(50,8);
cout<<admno;
gotoxy(50,9);

:";

cout<<name;
gotoxy(50,10);
cout<<fname;
gotoxy(50,11);
cout<<mname;
gotoxy(50,12);
cout<<dob;
gotoxy(50,13);
cout<<ph;
gotoxy(50,14);
cout<<add;
gotoxy(50,15);
cout<<age;
gotoxy(50,16);
cout<<occup;
gotoxy(50,17);
cout<<cls;
gotoxy(50,18);
cout<<sec;
gotoxy(10,24);
cout<<"DO YOU WANT TO ISSUE TC Y/N." ;
ch=getch();

if ( ch!='y')
q.write((char *) &x,sizeof(std));
}
}
q.close();
k.close();
remove("std.dat");
rename("std.dat","tmp.dat");

if ( f==0)
{
gotoxy(25,13);
cout<<"ADMISSION NO DOES NOT EXIST ." ;
getch();
}
}

void sub_menu()

{
std s;
char ch;
do
{

clrscr();
back1();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(34,6);
textcolor(13);
clreol();
cout<<"S U B

M E N U ";

gotoxy(23,8);

textcolor(1);
cout<<"1.ADD NEW ADMISSION";
gotoxy(23,10);

textcolor(12);
cout<<"2. DISPLAY DETAILS OF A STUDENT";

gotoxy(23,12);
textcolor(11);
cout<<"3. ISSUE T.C.";
gotoxy(23,14);
textcolor(14);
cout<<"4. BACK TO MAIN MENU";
gotoxy(23,16);
textcolor(14);
cout<<"ENTER YOUR CHOICE";
gotoxy(40,16);
cin>>ch;

switch(ch)
{
case '1':
s.add_student();
break;
case '2':
s.disp();

break;

case '3':
s.tc();
break;
}
}while( ch!='4');
}
class acd
{
char admno[5];
char name[20];
char cls[5];
char sec;
char e_name[20];
float m1;
float m2;
float m3;
float m4;
float m5;
float m6;

float ttl;
float perc;
char grade;
public:
char * getadmno()
{
return admno;
}
char * getcls()
{
return cls;
}
friend void classwise();

void enter();
void disp();
void modify();
void class_toppers();
};

void acd::class_toppers()
{

clrscr();
back();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(34,6);
textcolor(13);
char g[5];
gotoxy(30,13);
cout<<"ENTER CLASS [ IN ROMAN]";
gets(g);
clrscr();
clrscr();
back();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";

ifstream k;
k.open( "aca.dat",ios::in|ios::binary);

if ( !k)
{
gotoxy(30,13);
cout<<"FILE DOES NOT EXIST ";
return;
}
acd h;
acd t1,t2,t3;
float p1,p2,p3;

while( !k.eof())
{
k.read((char *) &h, sizeof(acd));
p1=h.ttl;
p2=h.ttl;
p3=h.ttl;
t1=t2=t3=h;

if ( h.ttl>p1)
{
p1=h.ttl;

t1=h;
}
if (( p2<p1)&&(p1<h.ttl))
{
p2=p1;
t2=t1;
}
if (( p3<p2)&&(p2<p1))
{
p3=p2;
t3=t2;
}
}

gotoxy(20,3);
cout<<"TOPPER 1 DETAILS ";
gotoxy(20,5);
cout<<"CLASS NAME ";
gotoxy(20,7);
cout<<"CLASS ";
gotoxy(20,9);
cout<<"TOTAL MARKS ";

gotoxy(50,5);
cout<<t1.name;
gotoxy(50,7);
cout<<t1.cls;
gotoxy(50,9);
cout<<t1.ttl;
gotoxy(20,11);
cout<<"TOPPER 2 DETAILS ";
gotoxy(20,13);
cout<<"CLASS NAME ";
gotoxy(20,15);
cout<<"CLASS ";
gotoxy(20,17);
cout<<"TOTAL MARKS ";
gotoxy(50,13);
cout<<t2.name;
gotoxy(50,15);
cout<<t2.cls;
gotoxy(50,17);
cout<<t2.ttl;

gotoxy(20,19);

cout<<"TOPPER 3 DETAILS ";


gotoxy(20,21);
cout<<"CLASS NAME ";
gotoxy(20,23);
cout<<"CLASS ";
gotoxy(20,24);
cout<<"TOTAL MARKS ";
gotoxy(50,21);
cout<<t3.name;
gotoxy(50,23);
cout<<t3.cls;
gotoxy(50,24);
cout<<t3.ttl;
k.close();
}

void acd::modify()

{
clrscr();
fstream k;
k.open("aca.dat",ios::in|ios::out|ios::binary);
if ( !k)
{
gotoxy( 35,15);
cout<<"FILE DOES NOT EXIST

";

delay(3000);
return;
}
char r[5];
cout<<"ENTER ADMNO TO MODIFY
cin>>r;
int f=0;
long pos;
acd d;
while(!k.eof())
{
pos=k.tellg();
k.read((char*)&d, sizeof(acd));
if (strcmp(d.getadmno(),r)==0)

";

{
f=1;
break;
}
}

if (f==0)
{
gotoxy( 35,15);
cout<<"ADMNO DOES NOT EXIST
delay(5000);
return;
}
clrscr();
gotoxy(15,2);
cout<<"ADMISSION NUMBER
gotoxy(15,3);
cout<<"NAME

:" ;

gotoxy(15,4);
cout<<"CLASS
gotoxy(15,5);

:" ;

:";

";

cout<<"SECTION

:"

gotoxy(15,6);
cout<<"ENTER NAME OF EXAM

:"

gotoxy(15,7);
cout<<"ENTER MARKS OF ENGLISH

:"

gotoxy(15,9);
cout<<"ENTER MARKS OF HINDI

:"

gotoxy(15,11);
cout<<"ENTER MARKS OF SANSKRIT

:"

gotoxy(15,13);
cout<<"ENTER MARKS OF SCIENCE

:"

:"

gotoxy(15,15);
cout<<"ENTER MARKS OF MATHS
gotoxy(15,17);
cout<<"ENTER MARKS OF S.ST

:"

gotoxy(50,2);
cout<<admno;
gotoxy(50,3);
cout<<name;
gotoxy(50,4);
cout<<cls;
gotoxy(50,5);

cout<<sec;
gotoxy(50,6);
gets(e_name);
gotoxy(50,7);
cin>>m1;
gotoxy(50,9);
cin>>m2;
gotoxy(50,11);
cin>>m3;
gotoxy(50,13);
cin>>m4;
gotoxy(50,15);
cin>>m5;
gotoxy(50,17);
cin>>m6;
ttl=m1+m2+m3+m4+ m5 + m6;
perc= (m1+m2+m3+m4+ m5 +m6)/6;
if(perc>=75)
grade='A';
else
if((perc<=60)||(perc>=50))
grade='B';

else
grade='C';

char ch;
gotoxy(20,22);
cout<<"DO YOU WANT TO SAVE THE RECORD ";
gotoxy(50,22);
cin>>ch;
if ( ch=='y')
{
k.seekp(pos);
k.write((char*)&d,sizeof(acd));
gotoxy(20,22);
cout<<"RECORD HAS BEEN SAVED
delay(3000);
}
else
{
gotoxy(20,22);
cout<<"RECORD HAS NOT BEEN SAVED";
delay(5000);
}

";

k.close();
}

void acd::enter()
{
clrscr();
char l_admno[10];
back();
gotoxy( 35,15);
cout<<"PLEASE ENTER ADMNO ";
gotoxy( 55,15);
gets(l_admno);
int f=0;
ifstream k;
k.open("std.dat",ios::in|ios::binary);
if ( !k)
{
gotoxy( 35,15);
cout<<"FILE DOES NOT EXIST

";

delay(3000);
return;
}
std s;
while(!k.eof())
{
k.read((char*) &s, sizeof(std));
if (strcmp(s.getadmno(),l_admno)==0)
{
f=1;
}
}

if (f==0)
{
gotoxy( 35,15);
cout<<"ADMNO DOES NOT EXIST
delay(5000);
return;
}
acd d;
strcpy(d.admno, s.getadmno());

";

strcpy(d.name, s.getname());
strcpy(d.cls,s.getcls());
d.sec=s.getsec();

clrscr();
gotoxy(15,2);
cout<<"ADMISSION NUMBER IS

:";

gotoxy(15,3);
cout<<"NAME IS

:" ;

gotoxy(15,4);
cout<<"CLASS IS

:" ;

gotoxy(15,5);
cout<<"SECTION IS

:"

gotoxy(15,6);
cout<<"ENTER NAME OF EXAM

:"

gotoxy(15,7);
cout<<"ENTER MARKS OF ENGLISH:"

gotoxy(15,9);
cout<<"ENTER MARKS OF HINDI :"

gotoxy(15,11);
cout<<"ENTER MARKS OF SANSKRIT:"
gotoxy(15,13);

cout<<"ENTER MARKS OF SCIENCE :"

gotoxy(15,15);
cout<<"ENTER MARKS OF MATHS

:"

gotoxy(15,17);
cout<<"ENTER MARKS OF S.ST

:"

gotoxy(50,2);
cout<<d.admno;
gotoxy(50,3);
cout<<d.name;
gotoxy(50,4);
cout<<d.cls;
gotoxy(50,5);
cout<<d.sec;
gotoxy(50,6);
gets(d.e_name);
gotoxy(50,7);
cin>>d.m1;
gotoxy(50,9);
cin>>d.m2;
gotoxy(50,11);
cin>>d.m3;
gotoxy(50,13);

cin>>d.m4;
gotoxy(50,15);
cin>>d.m5;
gotoxy(50,17);
cin>>d.m6;
d.ttl=d.m1+d.m2+d.m3+d.m4+ d.m5 + d.m6;
d.perc= (d.m1+d.m2+d.m3+d.m4+ d.m5 + d.m6)/6;
if(d.perc>=75)
d.grade='A';
else
if((d.perc<=60)||(d.perc>=50))
d.grade='B';
else
d.grade='C';
char ch;
gotoxy(20,22);
cout<<"DO YOU WANT TO SAVE THE RECORD ";
gotoxy(50,22);
cin>>ch;
if ( ch=='y')
{ofstream p;
p.open("aca.dat",ios::out|ios::app|ios::binary);

p.write(( char *)&d, sizeof(acd));


p.close();
gotoxy(20,22);
cout<<"RECORD HAS BEEN SAVED
delay(3000);
}else
{ clrscr();
gotoxy(20,22);
cout<<"RECORD HAS NOT BEEN SAVED";
delay(5000);}
}

void acd::disp()
{
clrscr();
char l_admno[10];
back();
gotoxy( 35,15);
cout<<"PLEASE ENTER ADMNO ";

";

gotoxy( 55,15);
gets(l_admno);
int f=0;
ifstream k;
k.open("aca.dat",ios::in|ios::binary);
if ( !k)
{
gotoxy( 35,15);
cout<<"FILE DOES NOT EXIST

";

delay(3000);
return;
}
acd s;

while(!k.eof())
{
k.read((char*) &s, sizeof(std));
if (strcmp(s.getadmno(),l_admno)==0)
{
clrscr();
gotoxy(15,2);
cout<<"ADMISSION NUMBER IS

:";

gotoxy(15,3);
cout<<"NAME IS

:" ;

gotoxy(15,4);
cout<<"CLASS IS

:" ;

gotoxy(15,5);
cout<<"SECTION IS

:"

gotoxy(15,6);
cout<<"NAME OF EXAM

:"

gotoxy(15,7);
cout<<"MARKS OF ENGLISH:"

gotoxy(15,9);
cout<<"MARKS OF HINDI :"

gotoxy(15,11);
cout<<"MARKS OF SANSKRIT:"

gotoxy(15,13);
cout<<"MARKS OF SCIENCE :"

gotoxy(15,15);
cout<<"MARKS OF MATHS

:"

gotoxy(15,17);
cout<<"MARKS OF S.ST

:"

gotoxy(50,2);
cout<<s.admno;

gotoxy(50,3);
cout<<s.name;
gotoxy(50,4);
cout<<s.cls;
gotoxy(50,5);
cout<<s.sec;
gotoxy(50,6);
cout<<s.e_name;
gotoxy(50,7);
cout<<s.m1;
gotoxy(50,8);
cout<<s.m2;
gotoxy(50,9);
cout<<s.m3;
gotoxy(50,10);
cout<<s.m4;
gotoxy(50,11);
cout<<s.m5;
gotoxy(50,12);
cout<<s.m6;
gotoxy(50,14);
cout<<s.perc;

gotoxy(50,16);
cout<<s.grade;
f=1;
}
}

if ( f==0)
{
gotoxy( 35,15);
cout<<"ADMNO DOES NOT EXIST
delay(5000);
return;
}
k.close();
delay(3000);
}

void sub_menu1()
{

";

acd s;
char ch;
do
{
clrscr();
back1();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(34,6);
textcolor(13);
clreol();
cout<<"S U B

M E N U ";

gotoxy(23,8);

textcolor(1);
cout<<"1.NEW MARKS ENTRY";
gotoxy(23,10);

textcolor(12);
cout<<"2. MODIFY EXAM DETAILS";

gotoxy(23,12);
textcolor(11);
cout<<"3. ADACEMIC DETAILS OF A STUDENT";
gotoxy(23,14);
textcolor(14);
cout<<"4. BACK TO MAIN MENU";
gotoxy(23,16);
textcolor(14);
cout<<"ENTER YOUR CHOICE";
gotoxy(40,16);
cin>>ch;

switch(ch)
{
case '1':
s.enter();
break;
case '2':
s.modify();
break;
case '3':

s.disp();
getch();
break;
}
}while( ch!='4');
}

void c_list()
{
clrscr();
std g;
ifstream k;
k.open("std.dat",ios::in|ios::binary);
if ( !k)
{
gotoxy(35,12);
cout<<"FILE DOES NOT EXIST";
delay(4000);
return;
}
int r=8;
clrscr();

back();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(5,6);
cout<<"NAME ";
gotoxy(20,6);
cout<<"CLASS ";
gotoxy(30,6);
cout<<"SEC.";
gotoxy(45,6);
cout<<"F.NAME

";

gotoxy(55,6);
cout<<"PH. NO .";
gotoxy(65,6);
cout<<"DOB ";

while(k.read((char *)&g, sizeof(std)))


{
gotoxy(5,r);
cout<<g.name;

gotoxy(20,r);
cout<<g.cls;
gotoxy(30,r);
cout<<g.sec;
gotoxy(45,r);
cout<<g.fname;
gotoxy(55,r);
cout<<g.ph;
gotoxy(65,r);
cout<<g.dob;
r+=2;
if ( r>=24)
{
gotoxy(5,6);
cout<<"NAME ";
gotoxy(15,6);
cout<<"CLASS ";
gotoxy(25,6);
cout<<"SEC.";
gotoxy(35,6);
cout<<"F.NAME
gotoxy(45,6);

";

cout<<"PH. NO .";
gotoxy(55,6);
cout<<"DOB ";
clrscr();
}
}
getch();
k.close();
}

void classwise()
{
clrscr();
acd g;
ifstream k;
k.open("aca.dat",ios::in|ios::binary);
if ( !k)
{
gotoxy(35,12);
cout<<"FILE DOES NOT EXIST";
delay(4000);
return;

}
char l_cls[20];
clrscr();
back();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(35,12);
cout<<"PLEASE ENTER CLASS [IN ROMAN]";
gets(l_cls);

int r=8;
clrscr();
back();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(5,6);
cout<<"CLASS ";
gotoxy(20,6);

cout<<"NAME ";
gotoxy(30,6);
cout<<"SEC.";
gotoxy(45,6);
cout<<"TOTAL";
gotoxy(55,6);
cout<<"%AGE";
gotoxy(65,6);
cout<<"GRADE";
while(k.read((char *)&g, sizeof(acd)))
{
if ( strcmp(l_cls,g.getcls())==0)
{
gotoxy(5,r);
cout<<g.name;
gotoxy(20,r);
cout<<g.cls;
gotoxy(30,r);
cout<<g.sec;
gotoxy(45,r);
cout<<g.ttl;
gotoxy(55,r);

cout<<g.perc;
gotoxy(65,r);
cout<<g.grade;
r+=2;
if ( r>=24)
{
gotoxy(5,6);
cout<<"NAME ";
gotoxy(15,6);
cout<<"CLASS ";
gotoxy(25,6);
cout<<"SEC.";
gotoxy(35,6);
cout<<"TOTAL

";

gotoxy(45,6);
cout<<"%AGE.";
gotoxy(55,6);
cout<<"GRADE ";
clrscr();
}
}
}

getch();
k.close();
}

void sub_menu2()
{
acd s;
char ch;
do
{
clrscr();
back1();
gotoxy(20,2);
clreol();
textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(34,6);
textcolor(13);
clreol();
cout<<"S U B
gotoxy(23,8);

M E N U ";

textcolor(1);
cout<<"1.CONSOLIDATED STUDENTS' RECORDS";
gotoxy(23,10);

textcolor(12);
cout<<"2. CLASSWISE ACADEMIC DETAILS";
gotoxy(23,12);
textcolor(11);
cout<<"3. CLASSWISE TOPPERS' DETAILS ";
gotoxy(23,14);
textcolor(14);
cout<<"4. BACK TO MAIN MENU";
gotoxy(23,16);
textcolor(14);
cout<<"ENTER YOUR CHOICE";
gotoxy(40,16);
cin>>ch;

switch(ch)
{
case '1':
c_list();

break;
case '2':
classwise();
break;
case '3':
s.class_toppers();
getch();
break;
}
}while( ch!='4');
}

void main_menu()
{
char ch;
do
{

clrscr();
back1();
gotoxy(20,2);
clreol();

textcolor(12+128);
cout<<"NO. 1 AIRFORACE SCHOOL : GWALIOR ";
gotoxy(34,6);
textcolor(13);
clreol();
cout<<"M A I N

M E N U ";

gotoxy(23,8);

textcolor(1);
cout<<"1. STUDENT DETAILS";
gotoxy(23,10);

textcolor(12);
cout<<"2. ACADEMIC DETAILS";

gotoxy(23,12);
textcolor(11);
cout<<"3. REPORTS";

gotoxy(23,14);

textcolor(14);
cout<<"4. EXIT";
gotoxy(23,16);
textcolor(14);
cout<<"ENTER YOUR CHOICE";
gotoxy(50,16);
cin>>ch;
switch(ch)
{
case '1':
sub_menu();
break;
case '4':
getch();
break;
case '2':
sub_menu1();
break;
case '3':
sub_menu2();
getch();
break;

}
}
while( ch!='4');
}

void main()
{
welcome();
textmode(C80);
main_menu();
getch();
}

You might also like