I have a class called Patients, and inside this class there is a structure called procedure.
Now, one of my function calls purpose is to update the struct procedure with values that the user enters. However, I don't know how to access the variables in the structure.
So basically I am having a problem when I am making my update procedure function.
class Patient
{
private:
int ID;
char firstName[15];
char lastName[15];
Date birthdate;
int DoctorID;
struct procedure
{
Date dateOfProcedure;
int procedureID;
int procedureProviderID;
};
public:
Patient(int ID, constchar *, constchar *, Date, int); //Put in default values
// just as in Date class
Patient();
//Use the set functions so input values are checked
Patient &setID(int);
Patient & setFirstName(constchar *); //check if length of name string is <
// 15, if not, shorten to 14 letters.
Patient & setLastName(constchar *); //check if length of name string is <
// 15, if not, shorten to 14 letters.
Patient & setBirthDate(Date);
Patient & setPrimaryDoctorID(int);
Patient & operator=(const Patient& a);
int getID();
constchar * getFirstName();
constchar * getLastName();
Date getBirthDate();
int getPrimaryDoctorID();
//tries to add a new entry to record array, returns
//true if added, false if cannot be added
bool enterProcedure(Date procedureDate, int procedureID, int procedureProviderID);
void printAllProcedures();
~Patient();
};
The function which I'm trying to update is:
bool enterProcedure(Date procedureDate, int procedureID, int procedureProviderID);
void checkOut(Patient *&checkIn, Patient *&All, int &count, int Checksize)
{
int checkID;
int procID;
int provID;
int dd, mm, yy;
cout << "Please enter the ID of the patient you wish to check out:" << endl;
cin >> checkID;
for (int i = 0; i < Checksize; i++)
{
if (checkID == checkIn[i].getID())
{
cout << "Patient found, please update the procedure..." << endl;
cout << "Please enter the current date (mm/dd/yy): " << endl;
cin >> mm; cout << "/"; cin >> dd; cout << "/"; cin >> yy;
cout << endl;
Date Proc(mm, dd, yy);
cout << "Enter the new procedure ID:" << endl;
cin >> procID;
cout << "Enter the new provider ID: " << endl;
cin >> provID;
checkIn[i].enterProcedure(Proc, procID, provID);
}
}
}
So when I pass the values as arguments into enterProcedure function, how do I set dateOfProcedure = Proc?