Why can't C++ add, subtract, divide, or multiply?
I'm currently learning how to use the Unreal Engine and want to learn C++. To better understand the language, I tried to make a console game with it, but there are a few errors in the game and I don't understand why they exist.
Leg of a gold mine In the game you are supposed to get 75G and in the first round the player's power is supposed to increase by 50, but it always says (no matter how often I buy the mine) that I have 75G and player power is 50 and when I want to buy a tower it says I don't have enough G even though the tower costs 50G.
Can anyone help me?
Here is the source code:
(Didn’t fit into the question anymore.)
Thanks for the criticism, I will try to improve the next time, but that still does not answer my question.
Yes, my second point fully answers your question. You create an object a and an object b, then change b and wonder why a was not changed. You should either send the target object into the changing functions as a pointer/reference or consider a different, more meaningful program structure that simplifies you all. As I said, I would rather move all logic into class, image the gamestate through the class and make the functions non-static (i.e., use OOP as it is actually intended).
The criticism is quite fundamental. He says: clean up and solve your problems.