C++ File Handling Binary files - class EMPLOYEE

Assuming the class EMPLOYEE given below, write functions in C++ to perform following:

(i) Write the objects of EMPLOYEE to a binary file.
(ii) Read the objects of EMPLOYEE from binary file and display them on screen.

Assuming the class EMPLOYEE given below, write functions in C++ to perform following:  (i) Write the objects of EMPLOYEE to a binary file. (ii) Read the objects of EMPLOYEE from binary file and display them on screen.
C++ File Handling Binary files - class EMPLOYEE 


Solution:
class EMPLOYEE
{
            int ENO;
            char ENAME[10];
            public :
            void GETIT()
            {
                        cin >> ENO;
                        gets (ENAME);
            }
            void SHOWIT()
           {
                        cout <<ENO << ENAME <<endl;
            }
};

This C++ Program executes the objects of EMPLOYEE to a binary file and Read the objects of EMPLOYEE from binary file and display them on screen.


Learn More :