Ask your own question, for FREE!
Computer Science 60 Online
sleepyjess:

@ultrilliam

Ultrilliam:

Ya this is probably much more ideal, lol

Ultrilliam:

So where did I lose you in DM's?

sleepyjess:

hold on... let me see if I'm as lost as I think I am...

sleepyjess:

sooooo.... I'm getting an error in the files that were given to us...

Ultrilliam:

What's the error?

sleepyjess:

1 attachment
Ultrilliam:

And changing that to DoctorList.h?

sleepyjess:

DoctorList.h:19:12: error: 'Doctor' does not name a type static Doctor doctors[]; ^~~~~~

sleepyjess:

it seems like all of the files have the #include "Doctor.h" though

Ultrilliam:

Had a feeling we would hit a brick wall there lol

Ultrilliam:

Hm

sleepyjess:

so am I supposed to create another file named Doctor.h?

Ultrilliam:

Hm, yea, throw this in Doctor.h ```cpp /* * File : DoctorList.h * Author: Ricky Landry (rlandry) * Course: COP3014 * Proj : Project 02 * Descr : The declaration of the class that contains the initialized list * of doctors available to be scheduled for the day. * */ #ifndef DOCTORLIST_H_ #define DOCTORLIST_H_ #include "Doctor.h" class DoctorList { public: static Doctor doctors[]; static const int size; }; #endif /* DOCTORLIST_H_ */ /* * File : DoctorList.cpp * Author: Ricky Landry (rlandry) * Course: COP3014 * Proj : Project 02 * Descr : The definition of the class that contains the initialized list * of doctors available to be scheduled for the day. */ #include "DoctorList.h" Doctor DoctorList::doctors[] = { {"Gerardo Socia", 45, "Ophthalmology"}, {"Jeremy Porche", 31, "Neurology"}, {"Tamiko Poat", 57, "Pediatrics"}, {"Marjorie Weatherman", 27, "Rheumatology"}, {"Cheyenne Stevenson", 35, "Cardiology"} }; const int DoctorList::size = sizeof(doctors)/sizeof(Doctor); ```

sleepyjess:

make all of that Doctor.h

sleepyjess:

?

Ultrilliam:

Wait back that up

Ultrilliam:

Let's go back a bit to this, what file does this come from (the error)

1 attachment
sleepyjess:

DoctorList.cpp

sleepyjess:

no, PatientList.cpp

sleepyjess:

it says DoctorList.cpp on the pic, but now that file is giving different errors...

sleepyjess:

OOOOHHHHH, that's from DoctorList.h

sleepyjess:

giving the same exact error for all 4 files

sleepyjess:

all saying there's no Doctor.h

Ultrilliam:

Okay, Let's just create a blank Doctor.h then and see what happens

sleepyjess:

new errors!

Ultrilliam:

yay

Ultrilliam:

LOL

Ultrilliam:

Now let's create patient.h

sleepyjess:

did that

sleepyjess:

1 attachment
Ultrilliam:

```cpp typedef string Doctor; typedef string Patient; ```

sleepyjess:

where do I put those?

Ultrilliam:

At the top of the Doctor/Patient files

Ultrilliam:

(lists)

sleepyjess:

in the cpp or h files? or both?

Ultrilliam:

`typedef string Patient;` in the patient files `typedef string Doctor;` in the doctor files

Ultrilliam:

Probably only the CPP is needed, since it would already be there once the .h files are included

sleepyjess:

sleepyjess:

The first error in both cpp files is coming from the .h files

sleepyjess:

I is back

Ultrilliam:

Whew, that's earlier then expected lol

sleepyjess:

I said 2 hours... it's been just over 2 hours lol

Ultrilliam:

Oh, I read 5 hours

sleepyjess:

still getting this: ``` DoctorList.cpp:9:9: error: 'string' does not name a type typedef string Doctor; ^~~~~~

Ultrilliam:

```cpp typedef char Doctor; typedef char Patient; ``` v2?

sleepyjess:

okay, now only this: ``` DoctorList.cpp:17:77: error: braces around scalar initializer for type 'Doctor {aka char}' {"Cheyenne Stevenson", 35, "Cardiology"} }; ^

sleepyjess:

and for PatientList.cpp: ``` In file included from PatientList.cpp:10:0: PatientList.h:19:12: error: 'Patient' does not name a type static Patient patients[]; ^~~~~~~ PatientList.cpp:13:31: error: 'Patient PatientList::patients []' is not a static data member of 'class PatientList' Patient PatientList::patients[] = { {"Alan Harry", 24, "Male"}, ^ PatientList.cpp:60:76: error: braces around scalar initializer for type 'Patient {aka char}' {"Mazie Harry", 70, "Other"} }; ^ PatientList.cpp:62:38: error: 'patients' was not declared in this scope const int PatientList::size = sizeof(patients)/sizeof(Patient); ^~~~~~~~

sleepyjess:

this is very frustrating...

Ultrilliam:

Hm

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!