CBSE (Science) Class 12CBSE
Share
Notifications

View all notifications

Find the Output of the Following C++ Code Considering that the Binary File Clients.Dat Exists on the Hard Disk with a Data of 200 Clients: - CBSE (Science) Class 12 - Computer Science (C++)

Login
Create free account


      Forgot password?
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

Find the output of the following C++ code considering that the binary file CLIENTS.DAT exists on the hard disk with a data of 200 clients:

class CLIENTS
{
    int CCode; char CName[20];
public:
    void REGISTER(); void DISPLAY();
};

void main()
{
    £stream File;
    File.open("CLIENTS.DAT", ios::binary|ios::in);
    CLIENTS C;
    File.seekg(6*sizeof(C));
    File.read((char*)&C, sizeof(C));
    cout<<"Client Number: "<<File.tellg()/sizeof(C) + 1;
    File.seekg(0 , ios :: end) ;
    cout<<"of"<<File.tellg(}/sizeof(C)<<endl;
    File.close();
}

Solution

Client Number: 7 of 200

  Is there an error in this question or solution?
Solution Find the Output of the Following C++ Code Considering that the Binary File Clients.Dat Exists on the Hard Disk with a Data of 200 Clients: 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.
S
View in app×