I'm doing a Lab assignment for my C++ class, but I'm stuck on some errors which I can't understand. I need someone expertise here. Below is my code. I supposes to run them and give me the values of playername, playerid, currentlevel and topfivescore.
You mention you are getting errors, but you didn't mention which errors you are getting?
Does the program compile? If not, which compilation errors do you get? Does the program crash, if so with which error? Are you expecting different output, if so, which output do you get and which do you expect?
Please let us know the errors you get and we'll be more equipped to help you.
You are most likely experiencing the downside of using raw pointers and C-strings: segmentation faults.
These occur when your program tries to access memory that is outside the bounds of the memory provided to it by the operating system, or when you try to free unallocated memory.
If you have a debugger they can usually help you track these errors down. Clicking "break" may actually take you to a backtrace of what has happened. ANother way to figure this out is to put a std::cout statement after every line in main(), so you have an idea which function is causing the error.
Perhaps try that and get back to us with your revised code, so we can have a look.