Doctor Data File Set Up

Doctor Data is the first C++ exercise with two files (doctor_data.cpp and doctor_data.h). How should the files be set up so that the tests starts passing? I know I have to declare the classes and functions in the namespace inside the doctor_data.h header file.

doctor_data.h

#ifndef DOCTOR_DATA_H
#define DOCTOR_DATA_H
#include <string>

namespace star_map {
    enum class System { BetaHydri, EpsilonEridani, Sol, AlphaCentauri, DeltaEridani, Omicron2Eridani };
}

namespace heaven {
        class Vessel { 
        public:
            std::string name;
            int count;
            star_map::System system;

            heaven::Vessel replicate(std::string);
            star_map::System current_system {};
            int generation {0};

            Vessel (std::string name = "", int count = 1, star_map::System system = star_map::System::Sol) : name(name), count(count), system(system) {}; 
            
            int busters;
            void make_buster();
            bool shoot_buster();
        };

        std::string get_older_bob(heaven::Vessel, heaven::Vessel);
        bool in_the_same_system(heaven::Vessel, heaven::Vessel);
}

#endif

I decided to download the code to run locally. I have always used the web interface previously. Now I can see the doctor_data_test.cpp file. I was able to configure the code in the doctor_data.cpp file. Now I am able to pass a test.

What do you think is missing from the instructions that would have helped you to solve it in the online editor?

1 Like

@vaeng I think the instructions are well-written. I put the declarations in the header file and the definitions in the source files and my test failed with a big ugly C++ error message. I got a lot of different error messages. I was just not sure if I had put the correct code in the correct files that is why I made this post.
I figured out what to do by looking at the error messages in the output. As soon as I post in the forum I figure it out on my own.

@vaeng by the way, task 2 is not showing.

task_2_not_showing

Thanks, I made a PR :slight_smile:

1 Like