Hello strangerone,
You are right. With your OP (original post) few if any will be willing to do your work for you.
In the "person.h" file the "#pragma once" is nice, but you should learn the include guard.
Something like:
1 2 3 4 5 6
|
#ifndef _PERSON.h_
#define _PERSON.h_
// <--- Your code here.
#endif // !_PERSON.h_
|
Next the lines:
1 2
|
#include <stdio.h>
#include <string.h>
|
Should not be in a header file. In the future this could cause big problems. These includes should be in a ".cpp" file.
Looking at these header files makes me think that this is a C program not a C++ program. "class"es are C++ and not available to C programs.
Although you can mic C++ and C code it is not a good idea. With your version of VS 2015 I guarantee "strcpy()" will be a problem in a C++ program.
As I look at the header files I see C style strings (character arrays). Are you stuck with using these or can you use the "std::string", header file "<string>", which would work better and you would not nee the C function "strcpy()".
The public section looks alright, but I am a bit rusty on C code I will need to compile and test the code.
In "person.cpp" The first lines you are missing are the include files that are in "person.h". The ".cpp" file needs to have them here not from a header file like "person.h".
In the default ctor I would do something to give the C strings a value instead of the garbage that is there.
The rest of the functions look OK for now. I will know more when I compile and test the functions.
In "Athlete.h" I would make "distance" a "double" since it is a number. As a character array you will fine it difficult to use in calculations.
In "Athlete.cpp" you will need to also have it deal with a "double".
In the ctor this is a good place to give "distance" a value before it is used.
I too use VS (Visual Studio). Just upgraded to the 2017 version, but still have the 2015 version.
Thank you for the input file. That is a big help so everyone can use the same information and see what output differs.
I will load everything up and test. I will let you know what I find.
Hope that helps,
Andy