CBSE (Science) Class 12CBSE
Account
It's free!

User


Login
Register


      Forgot password?
Share
Notifications

View all notifications
Books Shortlist
Your shortlist is empty

Solution - Write a Definition for Function Countpics() in C++ to Read Each Object of a Binary File Photos.Dat, Find and Display the Total Number of Photos of Type Portrait. Assume that the File Photos.Dat is Created with the Help of Objects of Class Photos, Which is Defined Below - CBSE (Science) Class 12 - Computer Science (C++)

ConceptBinary File in C++ :- Creation of File, Writing Data into File, Searching for Required Data from File, Appending Data to a File, Insertion of Data in Sorted File, Deletion of Data from File, Modification of Data in a File

Question

Write a definition for function COUNTPICS() in C++ to read each object of a binary file PHOTOS.DAT, find and display the total number of PHOTOS of type PORTRAIT. Assume that the file PHOTOS.DAT is created with the help of objects of class PHOTOS, which is defined below :

class PHOTOS
{
   int PCODE ;
   char PTYPE[20]; //Photo Type as "PORTRAIT" ,"NATURE"
public:
   void ENTER()
   {
       cin>>PCODE;gets(PTYPE);
   }
   void SHOWCASE()
   {
       cout<<PCODE<<":" <<PTYPE<<endl;
   }
   char *GETPTYPE(){return PTYPE;}
};

Solution

You need to to view the solution
Is there an error in this question or solution?

APPEARS IN

2016-2017 (March) All India Set 4
Question 4.2 | 2 marks

Related Questions VIEW ALL [3]

Solution for question: Write a Definition for Function Countpics() in C++ to Read Each Object of a Binary File Photos.Dat, Find and Display the Total Number of Photos of Type Portrait. Assume that the File Photos.Dat is Created with the Help of Objects of Class Photos, Which is Defined Below concept: Binary File in C++ :- Creation of File, Writing Data into File, Searching for Required Data from File, Appending Data to a File, Insertion of Data in Sorted File, Deletion of Data from File, Modification of Data in a File. For the course CBSE (Science)
S