Good day! I have this class for Players:
#include<iostream>
using namespace std;
class Players
{
public:
char Level[2];
float SetPower();
};
Players Pl,
float Players::SetPower()
{
switch(Pl.Level)
{
case '1':
return 5000; break;
.........
}
}
int main()
{
Pl.Level='1';
cout<<"Your current Power is: "<<Pl.SetPower()<<endl;
system("pause");
return 0;
}
Now I got this error: "switch quantity not an integer". Im not switching "int" here but "char". Whats wrong with my code?
I dont want yo use if else as it makes it ugly.
Thank you!