Fill in the blanks marked as Statement 1 and Statement 2, in the program segment given below with appropriate functions for the required task.
class Agent
{
long ACode; //Agent Code
char AName [2 0] ; //Agent Name
int Commission;
public:
void Enter (); //Function to enter details of Agent
void Display (); //Function to display details of Agent
void Update (int c) //Function to modify commission
{
Commission = C;
}
int GetComm(){return Commission;}
long GetAcodeO {return Acode;}
};
void ChangeCommission (long AC, int CM)
//AC " Agent Code, whose commission needs to change
//CM " New Commission
{
fstream F;
F. open ("AGENT.DAT", ios : :
binary |ios : : in|ios : : out);
char Changed='N';
Agent A;
while (Changed=='N'&& F. read ((char*) &A, size of (A)))
{ if (A. GetAcode ()==AC)
{
Changed = 'Y';
A. Update (CM);
//Statement 1: To place file pointer to the required position
------------------------;
//Statement 2: To write the object A on to the binary file
-------------------------;
}
}
if (Changed=='N')
cout <<"Agent not registered.";
F. close ();