I'm new to C++ and I'm working my way though some beginners tutorials and making simple programmes from what I've learned.
I've gotten up to Structures so I decided to make an RPG scenario where you meet a group of people and choose from some options which either raises your health or gets you killed.
I've created a Structure containing the players mana, health and money and declared them in main(). I also set a value to each one. When it comes to choice, it's meant to take away some of your money and raise your health. Instead, they stay the same.
the first of these lines takes 2 from player.money but does not store the result anywhere
Use
player.money = player.money - 2;
or
player.money -= 2;
Similarly for +/+= (careful! player =- 2; is also valid syntactically, but is just setting the variable to -2. That is, its the same as = -2)
And as Galok said, you should not be calling main() from main(). This will cause the program to run out of stack space if the games continues for long enough (Each function call uses a bit of stack memory which is released when you return from the function. But calling main, main, main, ... means you are not returning, and hence not freeing the memory!)
Thanks, that seemed to work. One last question though, what could I use instead of system("CLS")? I know that it's bad practise to use but I can't find an alternative.