1. Check your notes or whatever information you have on that Spinner class. Apparently you should have this information. We don't.
2. Check the main program: you need to implement, at the very least, a struct or class SpinnerSlot, and three functions, like this:
struct SpinnerSlot {
};
SpinnerSlot* AddSlot(const SpinnerSplot* someSpinner, const char* someString) {
}
void PrintSpinner(SpinnerSlot* someSpinner) {
}
void Spin(const SpinnerSlot* someSpinner) {
}
You should rename the function arguments to something that better reflects what these objects are or represent, depending on the information you have.
What goes into this struct or into these functions we cannot know: you have the information, and you are supposed to put it into code.
3. Bonus: Clean up after yourself! Since you are dealing with pointers to structs, you probably create such objects on the heap at some point (probably in AddSlot). But these objects are never released! They should be freed again before the program ends. So you could write another function to do this and then call it at the end of main():
SpinnerSlot* Cleanup(const SpinnerSlot* firstSpinner) {
return nullptr; }
int main() {
start = Cleanup(start);
return 0;
}
Note how the call to Cleanup is used to initialize start back to
nullptr
. While not strictly needed here, it is a good practice to make sure that you clear a pointer once the object it points to is released.
On a sidenote, you should not use
NULL
in C++ code!
NULL
is an outdated symbol that was used to initialize anything in a C program, but in C++ it has been replaced by
nullptr
for pointers, or simply
0
for numbers. It is important to make this distinction in modern C++ code and you better get used to it earlier rather than later.