Issue with Float command not working (1st Week of Coding)

Viewed 44

So I am trying to learn C++ and apart of taking basic courses online, I also try to create programs and put my spin on them to learn. I have a very old tutorial that was teaching how to create a battle simulator - I keep getting an error that I can't figure out. The code I have is here:


    default_random_engine RandomEngine(time(nullptr));
    uniform_real_distribution<float> attack(0.0f, 1.0f);

   // Human Properties
   float HumanAttack = 0.6f;
   float HumanHealth = 250.0f;
   float HumanDamage = 200.0f;
   float CurrentHumanHealth = HumanHealth

   // Skeleton properties
   float SkeletonAttack = 0.4f;
   float SkeletonHealth = 150.0f;
   float SkeletonDamage = 55.0f;
   float CurrentSkeletonHealth = SkeletonHealth;

   float AttackResult;

   int numskeletons;
   int numhumans;

I keep getting an error ' Expected ',' or ';' before 'float'

I have been looking things up but as I said - I'm in the first week. Maybe this is to advanced, but I am trying to play with code to parse it out. I appreciate any help.

1 Answers

You have to add semicolon at the end of float CurrentHumanHealth = HumanHealth;

   // Human Properties
   float HumanAttack = 0.6f;

   float HumanHealth = 250.0f;

   float HumanDamage = 200.0f;

   float CurrentHumanHealth = HumanHealth;

   // Skeleton properties

   float SkeletonAttack = 0.4f;

   float SkeletonHealth = 150.0f;

   float SkeletonDamage = 55.0f;

   float CurrentSkeletonHealth = SkeletonHealth;

   float AttackResult;

   int numskeletons;

   int numhumans;
Related