+ 1

How can i assign the values of a void to an integer?

how can i make it so that everytime i cout << playerClass, it gives me health = 50? https://code.sololearn.com/cm7JTHRtB2M8/?ref=app https://code.sololearn.com/cm7JTHRtB2M8/?ref=app

25th Apr 2018, 8:28 PM
Nislo Mislo
Nislo Mislo - avatar
3 ответов
+ 3
I think what you are trying to do is to create an object. Here is a very simple code I made to help: https://code.sololearn.com/cCFs26CisxE5/?ref=app If you finish the C++ course, you will learn some of this.
25th Apr 2018, 10:39 PM
Zeke Williams
Zeke Williams - avatar
+ 1
we can do in so many way.. i do it this way #include <iostream> using namespace std; int health; int playerClass; int Rogue() { return health = 50; } int main() { playerClass = Rogue(); cout<<playerClass ; }
25th Apr 2018, 8:38 PM
Arun Tomar
Arun Tomar - avatar
+ 1
thank you so much
25th Apr 2018, 8:41 PM
Nislo Mislo
Nislo Mislo - avatar