#include<iostream.h> #include<fstream.h> using namespace std; class record { public: char name[10]; int tam,eng,mat; void input() { cout<<"\n Enter name"; cin>>name; cout<<"\nEnmter tam,eng,mat marks"; cin>>tam>>eng>>mat; } void output() { cout<<"\n Name:"<<name; cout<<"\nTotal:"<<tam+eng+mat; } }; void main() { record rec; int i,j; ofstream outfile; outfile.open("mark.dat",ios::out|ios::binary); j=sizeof(record); for(i=1;i<=5;i++) { rec.input(); outfile.write((char *) &rec,j); } outfile.close(); ifstream infile; infile.open("mark.dat",ios::in|ios::binary); for(i=1;i<=5;i++) { infile.read((char *) & rec,j); rec.output(); } infile.close(); }