In: Computer Science
Answer:-
Hello, I have written the required program in CPP. Please find it below. I have included all the 3 required files code.
Doctor.h
struct Doctor
{
   int medical_reg;
   int num_patients;
   float income;  
};
Doctor constructDoctor(int, int, float);
void displayDoctorInfo(Doctor);
Doctor addDoctor(Doctor, Doctor);
void compareDoctor(Doctor,Doctor);
Doctor.cpp
#include<iostream>
#include "Doctor.h"
using namespace std;
Doctor constructDoctor(int m,int n, float i)
{
   Doctor d1 = {m,n,i};
   return d1;
}
void displayDoctorInfo(Doctor d)
{
   cout<<"Medical Registration Number is
"<<d.medical_reg<<endl;
   cout<<"Number of Patients is
"<<d.num_patients<<endl;
   cout<<"Income is
"<<d.income<<endl;
}
Doctor addDoctor(Doctor d1, Doctor d2)
{
Doctor d3 ={-1,
d1.num_patients+d2.num_patients,d1.income+d2.income};
   return d3;  
}
void compareDoctor(Doctor d1,Doctor d2)
{
   if(d1.income>d2.income)
   {
   displayDoctorInfo(d1);  
   }
   else if(d1.income<d2.income)
   {
   displayDoctorInfo(d2);  
   }
   else
   {
   if(d1.num_patients>d2.num_patients)
   {
   displayDoctorInfo(d1);  
   }
   else if(d1.num_patients<d2.num_patients)
   {
   displayDoctorInfo(d2);  
   }
   else
   {
       cout<<"Doctors are
equal";
       }  
   }
}
Source.cpp
#include<iostream>
#include "Doctor.cpp"
using namespace std;
int main()
{
   int medical_reg,num_patients;
   float income;
   cout<<"Enter details for first Doctor\nEnter
Medical Registration Number";
   cin>>medical_reg;
   cout<<"Enter the number of patients ";
   cin>>num_patients;
   cout<<"Enter Income";
   cin>>income;
   Doctor d1 = {medical_reg, num_patients, income};
   cout<<"Enter details for Second Doctor\nEnter
Medical Registration Number";
   cin>>medical_reg;
   cout<<"Enter the number of patients ";
   cin>>num_patients;
   cout<<"Enter Income";
   cin>>income;
   Doctor d2 = {medical_reg, num_patients, income};
   cout<<"Information for First Doctor\n";
   displayDoctorInfo(d1);
   cout<<"Information for Second Doctor\n";
   displayDoctorInfo(d2);
   cout<<"Information for Third Doctors by adding
these two Doctors\n";
   displayDoctorInfo(addDoctor(d1,d2));
   cout<<"Information for greater Doctor\n";
   compareDoctor(d1,d2);
}
Screenshot of Code:-
Please refer to the screenshot of the code for properly understanding the indentation of the code.
Doctor.h

Doctor.cpp


Source.cpp

OUTPUT:-

Note:- Here, in the addDoctor() function, I have used a dummy value for medical registration number of a doctor which is -1.
I hope it would help.
Thanks!