Computer Science, asked by Farty45, 1 year ago

class student that contains records of students in a school. write a c++ program

Answers

Answered by AkashMandal
0
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
class student
{
int rno;
char name[20];
float mark;
public:
void get()
{
cout<<“\nEnter data: Roll no Name Marks\n”;
cin>>rno>>name>>mark;
}
void disp()
{
cout<<“\nRoll no\tName\tMarks\n”;
cout<<“=============================\n”;
cout<<rno<<“\t”<<name<<“\t”<<mark<<endl;
}
};
void main()
{
fstream f;
f.open(“school.dat”,ios::in|ios::out);
student s;
s.get();
f.write((char*)&s,sizeof(s));
while(f.read((char*)&s,sizeof(s)));
s.disp();
getch();
}
Similar questions