+ 1

I need help with a code

Hi I am a beginner in C++ so I am still learning how to do a use some of their functions, I was doing this project by myself but I can not find what is failing in it. I have been studying all night because my final is on Monday, so if you can help me out with it I will appreciate it. https://code.sololearn.com/cdm3ufm2uK0N/?ref=app

28th Apr 2019, 11:13 AM
A Hernan Muñoz
A Hernan Muñoz - avatar
11 Answers
+ 7
https://code.sololearn.com/canqdW0sH8OF/?ref=app Here is a quick rework of what I would do (based on what I think you a trying to do) There a few issues with your code. First is the duplication of inputs and outputs. You can accomplish the same thing in far less code with just a tweak of your existing print stats function and by adding another function to collect input (see above) totalpoints variable isn't available in the print stats function You seem to collect more than 3 players with the for loop you have included. Was this your intention? (most likely reason your calculations weren't working as expected) Is there a reason you are using a char array for the name? Strings are generally a better option. Anyway, if you have any questions about the code I attached please don't hesitate to ask.
28th Apr 2019, 12:15 PM
jay
jay - avatar
+ 5
Hi A Hernan Muñoz Please remove the code from the tag areas and just use the language (c++) that your question is about
28th Apr 2019, 11:20 AM
jay
jay - avatar
+ 4
Lol. I was wondering why there were so many tags.
28th Apr 2019, 11:27 AM
Sonic
Sonic - avatar
+ 2
All good! Thanks for changing it. It makes the question much easier to read. If you want you can also save the code in code playground and link it to your question. It allows people to run and debug the code in its entirety with ease
28th Apr 2019, 11:29 AM
jay
jay - avatar
+ 2
jay no problem, I will do it now thank you so much for the advice
28th Apr 2019, 11:32 AM
A Hernan Muñoz
A Hernan Muñoz - avatar
+ 2
jay I did it but don't know if you can see it
28th Apr 2019, 11:40 AM
A Hernan Muñoz
A Hernan Muñoz - avatar
+ 2
I can see it, give me a moment to go through it. It is a good attempt at first sighting though, some improvements could be made that reduce the duplication and enable the calculations to work correctly
28th Apr 2019, 11:46 AM
jay
jay - avatar
+ 1
Sorry hahaha I am new using the Q&A section
28th Apr 2019, 11:28 AM
A Hernan Muñoz
A Hernan Muñoz - avatar
+ 1
Sonic I am trying to do the math but don't know how to code it correctly, the cout displayed everything I want but the code doesn't do the math operation and I am burnout and haven't slept 😬
28th Apr 2019, 11:31 AM
A Hernan Muñoz
A Hernan Muñoz - avatar
+ 1
I will be aware of your answer âœŒđŸ»
28th Apr 2019, 12:03 PM
A Hernan Muñoz
A Hernan Muñoz - avatar
0
Thank you jay 😬, I have been trying all night long and watching some youtube videos while practicing for my final which is this Monday
28th Apr 2019, 11:49 AM
A Hernan Muñoz
A Hernan Muñoz - avatar