Professional Documents
Culture Documents
MINIMUM REQUIREMENT
1.Personal Computer(PC)
2.128 MB RAM
3.Windows 7 Operating System
4.Microsoft Disk Operating System(MS DOS)
5.Turbo C++3.0
6.CD
7.CD Drive
//program code
//header files used
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<stdio.h>
#include<fstream.h>
#include<iomanip.h>
//class definition
class student
{
int rollno; //to store rollno:ofstudent
char name[50]; //to store name of student
int p_marks,c_marks,m_marks,e_marks,cs_marks; //to store marks
//of diff subjects
{
cout<<"\nRoll no:";
cin>>rollno;
cout<<"Name:";
gets(name);
cout<<"Physics out of 100:";
cin>>p_marks;
cout<<"Chemistry out of 100:";
cin>>c_marks;
cout<<"Maths out of 100:";
cin>>m_marks;
cout<<"English out of 100:";
cin>>e_marks;
cout<<"Computer science out of 100:";
cin>>cs_marks;
calculate();
}
void showdata() //to display all details
{
cout<<"\nRollno:"<<rollno;
cout<<"\nName:"<<name;
cout<<"\nMarks";
cout<<"\n Physics:"<<p_marks;
cout<<"
Chemistry:"<<c_marks;
cout<<"
Maths:"<<m_marks;
cout<<"
English:"<<e_marks;
cout<<"
Computer Science:"<<cs_marks;
cout<<"\nPercentage:"<<setprecision(3)<<per;
cout<<" Grade:"<<grade;
}
"<<name<<"
"<<p_marks<<"
"<<m_marks;
cout<<"
"<<e_marks<<"
"<<setprecision(3)<<per<<"
"<<cs_marks<<"
"<<grade<<"\n";
"<<c_marks<<"
{
return rollno;
}};
//global declaration of variables
fstream fp;
student st;
fp.open("Student.dat",ios::binary|ios::in);
while(fp.read((char*)&st,sizeof(st)))
{
st.showdata();
cout<<"\n------------------------------------------;
cout<<------------------\n";
}
fp.close();
}
while(fp.read((char*)&st,sizeof(st)))
{
if(st.ret_rollno()==n)
{
clrscr();
st.showdata();
flag=1;break;
}}
fp.close();
if(flag==0)
cout<<"\nRecord not present";
}
TO MODIFY";
while(fp.read((char*)&st,sizeof(st))&&found==0)
{
if(st.ret_rollno()==no)
{
st.showdata();
cout<<"\nPlease enter the new details of the student";
st.getdata();
int pos=-1*sizeof(st);
fp.seekp(pos,ios::cur);
fp.write((char*)&st,sizeof(st));
cout<<"\nRecord updated";
found=1;break;
}}
fp.close();
if(found==0)
cout<<"\nRecord not found";
}
clrscr();
int no;
student st;
cout<<"\n
DELETE RECORD";
{
clrscr();
fp.open("Student.dat",ios::binary|ios::in);
if(!fp)
{
cout<<"\nERROR!!!FILE COULD NOT BE OPEN\n";
cout<<"\nGO TO ENTRY MENU TO CREATE FILE";
cout<<"\nPROGRAM CLOSING....";
exit(0);
}
cout<<"\n\n
STUDENT RESULT\n";
cout<<"-----------------------------------------------;
cout<<---------------------\n";
cout<<"Rollno
Name
Grade";
cout<<"\n---------------------------------------------;
cout<<----------------------\n";
while(fp.read((char*)&st,sizeof(st)))
{
st.show_tabular();
}
fp.close();
{
case 1:write_student();break;
case 2:display_all();break;
case 3:search_student();break;
case 4:modify_student();break;
case 5:delete_student();break;
case 6:break;
}
}
//main program
void main()
{
clrscr();
int ch;
do
{
cout<<"\n********MAIN MENU********";
cout<<"\n1.Result Menu";
cout<<"\n2.Entry/Edit Menu";
cout<<"\n3.Exit";
cout<<"\nSelect your choice(1-3):";
cin>>ch;
switch(ch)
{
case 1:result();
break;
case 2:entry_menu();break;
case 3:exit(0);
}
}while(ch!=3);
getch();
}
//program ends
//*******END OF PROJECT**********
RESULT MENU
CLASS RESULT
SEARCHING A PARTICULAR
RECORD
MODIFYING A RECORD
DELETING A PARTICULAR
RECORD
CLASS RESULT
*******EXIT FROM
PROGRAM*******
www.google.com
Computer Science with C++ class
XII by Sumita Arora