'(Bug) Switch Statement on a turn based game

So im tryna make a turn based game and i got a bug on the switch() statement. Here's my code :

#include <iostream>
using namespace std;
int main()
{
int choice;
int enemyhp;
enemyhp = 10;
do
{
cout<<"Oh no there is an enemy!";
cout<<"Please enter 1 if you want to attack!\n";
cin>>choice;
switch(choice)
{
case 1:
  if(enemyhp=10)
  {
  enemyhp-=3;
  cout<<"Wack!\n";
  cout<<"You wacked the enemy!\n";
  break;
  }
break;
default:
  cout<<"Enemy : That won't stop me\n";
  break;
}
}
while(1);
{
  cout<<endl;
}
}

What i expect :

  1. The player typed 1.
  2. The program does case 1.
  3. And then the enemy says "That won't stop me". ================================================== What it does :
  4. The player typed 1.
  5. The program does case 1.
  6. It goes back to the cout<<"Oh no there is an enemy!".
  7. Not the cout<<""That won't stop me".
c++


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source