Finding position in binary file using tellg()
CBSE12D-2016
Problem Statement - Counting of object containing a particular string match in a binary file
Write a definition for function COUNTDEPT( ) in C++ to read each object of a binary file TEACHERS.DAT, find and display the total number of teachers in the department MATHS. Assume that the file TEACHERS.DAT is created with the help of objects of class TEACHERS, which is defined below:
class TEACHERS { int TID; char DEPT[20]; public: void GET() { cin>>TID;gets(DEPT); } void SHOW() { cout<<TID<<":"<<DEPT<<endl; } char *RDEPT(){return DEPT;} };
Solution
CSKC| Created: 8-Jan-2019 | Updated: 28-Jan-2020|CBSE12D-2017