#C++, Doctor Data
14 messages · Page 1 of 1 (latest)
IIUC learning exercises don't display the test file. But you should still be able to run the tests.
Everything you need should be in the introduction and the instructions.
If you work locally, you can always look into the doctor_data_test.cpp file, but you don't need to. I put all the relevant information in the instructions.
Oh okay. Thanks
I was confused, why there is no Test tab visible
very nice excercise. Thank you. 🙂
As it is a very new exercise, I am happy to hear that. Was there anything unclear or frustrating for you?
I think it is very well explained and just enough for a beginner. In my haste I went directly looking for test file.
I have a request I do not know where would it best to post. It would be nice to have a concept tab for templates and exercises with easy, medium and hard difficulty as it is very tough topic to master. Thanks
It's on my list https://forum.exercism.org/t/state-of-the-c-syllabus-july23/6622. It's a pretty crowded list though
hi guys, I don't understand properly my error.
I finished (i think) all the exercise.
this is the doctor_data.h
#pragma once
#include <iostream>
#include <string>
namespace star_map {
enum class System {
EpsilonEridani,
BetaHydri,
Sol,
AlphaCentauri,
DeltaEridani,
Omicron2Eridani,
};
}
namespace heaven {
class Vessel {
public:
Vessel(const Vessel &other) = default;
Vessel(std::string name, int _generation) {
m_name = name;
generation = _generation;
};
Vessel(std::string name, int _generation, star_map::System system) {
m_name = name;
generation = _generation;
current_system = system;
};
bool operator > (const Vessel& other) const {
return generation > other.generation;
}
std::string m_name{};
int generation;
int busters = 0;
star_map::System current_system = star_map::System::BetaHydri;
void make_buster() {};
bool shoot_buster();
Vessel replicate(std::string vessel_name);
};
bool in_the_same_system(Vessel& v1, Vessel& v2) {
return v1.current_system == v2.current_system;
}
std::string get_older_bob(Vessel& v1, Vessel& v2) {
bool older = v1.generation > v2.generation;
if(older) {
return v1.m_name;
}
else {
return v2.m_name;
}
}
}
there are some errors:
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: CMakeFiles/doctor-data.dir/doctor_data.cpp.o: in function `heaven::in_the_same_system(heaven::Vessel&, heaven::Vessel&)':
/tmp/doctor-data/doctor_data.cpp:51: multiple definition of `heaven::in_the_same_system(heaven::Vessel&, heaven::Vessel&)';
/tmp/doctor-data/doctor_data_test.cpp:17: undefined reference to `heaven::Vessel::replicate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: CMakeFiles/doctor-data.dir/doctor_data_test.cpp.o: in function `CATCH2_INTERNAL_TEST_4()':
/tmp/doctor-data/doctor_data_test.cpp:27: undefined reference to `heaven::Vessel::shoot_buster()'
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/doctor-data/doctor_data_test.cpp:30: undefined reference to `heaven::Vessel::shoot_buster()'
what i'm doing wrong?
Please use a new thread, @balmy lava . The OP, ilm, doesn't need to be pinged for your question and a new thread helps other people who aren't already in this thread see your question!