My function only returns the value of 0...

I've been working on practicing functions, and so I've got a function that continuously returns 0 even after parameter changes, and I'm not exactly sure what is going on.

Header file excerpt of the function being used

void SetEnemyDamage(long DamageVarX, long DamageVarY, long DamageVarZ, long level)
{
if (level >= 1 && level <= 10)
{
enemydamage = (DamageVarX * DamageVarY)*(DamageVarZ / DamageVarX);
}
else if (level >= 11 && level <= 25)
{
enemydamage = (DamageVarX*(DamageVarZ) * DamageVarY) + ((2 ^ (level - DamageVarY)) / DamageVarZ);
}
else
{
enemydamage = (DamageVarX*DamageVarY) + (level*DamageVarZ);
}
}
long GetEnemyDamage()
{
return enemydamage;
}

main function

int main()
{
long PlayerLevel = 2;
int strength = 5;
int numofattackonweapon;
swords TrainingSword;
TrainingSword.setSwordDamage(strength, 10);
std::cout <<"Training sword deals "<< TrainingSword.getDamage() << " damage." << std::endl;
landenemy Muural;
Muural.SetEnemyDamage(6, 4, 3, PlayerLevel);
std::cout << "Muural deals " << Muural.GetEnemyDamage() << " damage at level 2." << std::endl;
std::cin >> money;
return 0;
}

As you can see, the muural always deals 0 damage, but for some reason the training sword works just fine, and I haven't been able to find a problem.
Change all you variables to float. Long only deal with whole numbers.
Topic archived. No new replies allowed.