Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.0k views
in Computer by (15 points)
edited by

Write a function in C++ to read and display the details of all the users, whose membership type is V or ‘M’ from a binary file CLUB.DAT. Assuming the binary file CLUB.DAT is containing objects of class CLUB, which is defined as follows:

class CLUB
{
int Mno;
char Mname[20];
//member name
char Type;
//member type :L Life Member
// M Monthly Member G Guest
public:
void Register();
//function to enter the content
void Display();
//function to display all
//data members
char WhatType()
{
return Type;
}
};

Please log in or register to answer this question.

1 Answer

0 votes
by (33.5k points)

void DisplayMember()
{
CLUB C;
ifstream fin;
fin.open("CLUB.DAT",ios::binary);
while(fin.read!(char*)&C.sizeof(C)))
{
if((C.WhatType()=='L')||
(C.WhatType!)=='M'))
C.Display();
}
fin.close();
}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...