Hello guys!
Hope everyone is safe and sound!
Im a student of Computer Science and engineering and this is my first year but i was more focused on the maths and physics and left programing behind.
I have a battle ship game that needs to have a 10x10 board. The rows are in between 1 and 10 and the collums are between A and J but what is giving hard times doing is that i need to have the header file and the source file working together and until this subject i've always worked only in the source file im not sure what to do next.
Hope someone is smarther than me and could help me starting this project.
:)
This is the code that the teachers gave to the students.
In general, you put that class declaration in a header file, like NavalPoint.h. Then you create a NavalPoint.cpp file and at the top you put: #include "NavalPoint.h"
The #include effectively pastes the file into that location in the source.
I have to say that sadly, this is another case of professor teaching bad habits. This class is full of sound and fury, signifying nothing. Each method is a one-liner. The class doesn't really need to exist. Worse, it encourages you to store the coordinates using NavalPoint. It's much better to store the coordinates using "computer friendly" numbers 0-9 for both vertical and horizontal. Then you convert to human-friendly 1-10 and A-J just after input from the user, and just before output to the user.
If you are not aware a class is private by default, so starting the class with "private" is redundant, but OK if you leave it.
int Get_int_y(void) const;. The "void" here is old and no longer necessary. Not sure if that was a change in C++ from the start of if it came from 1 of the standards in C++11 or earlier.
The "void" here is old and no longer necessary. Not sure if that was a change in C++ from the start of if it came from 1 of the standards in C++11 or earlier.
The void in a function with no parameters has never been a requirement in C++. I think it is really just a hangover from those who have done C programming, and are not aware of the difference with C++, because compilers ignore it. I also think it is not a requirement in C++ because it doesn't really help humans either :+)
I guess the aim of the assignment is to write all the functions and put it all together in main ?