0

How to subtract a value from a struct?

I have this code currently struct monster { short health, attack; monster() : health{50}, attack{10} { } }; How would I go about subtracting for sample 20 health so that the health becomes 30?

30th May 2018, 3:31 PM
Nislo Mislo
Nislo Mislo - avatar
3 Réponses
+ 1
FIRST CREATE VARIABLE OF TYPE monster SUPPOSE M1. THAN M1.health - 20
30th May 2018, 3:48 PM
Meet Mehta
Meet Mehta - avatar
+ 1
monster M1;
30th May 2018, 4:08 PM
Meet Mehta
Meet Mehta - avatar
0
how would i create the variable
30th May 2018, 4:00 PM
Nislo Mislo
Nislo Mislo - avatar