I can't find out why this attack sequence for a game isn't working, any ideas??

#include <iostream>
#include <string>
#include <time.h>
using namespace std;
int main()
{
int A;
int B;
int C;
int EHealth;
int EAttack;
int Health;
int Attack;
EHealth=10;
EAttack=2;
Health=8;
Attack=5;
cout<< "Start Fight:" ;
while(EHealth>1)
{
cout <<"Will You: Attack(A), Defend(D)" <<endl;
cin>> A;
if(A!='D' && A!='d')
{
cout<< "EHealth =" << EHealth-Attack << endl;
EHealth=EHealth-Attack;
system("PAUSE");}
else
{
cout<< "Health ="<< Health-EAttack/2 <<endl;
Health=EAttack/2;
system("PAUSE");}
B=rand()%1;
if(B!=0)
{
cout<< "Health =" << Health-EAttack <<endl;
Health=Health-Attack;
system("PAUSE");}
else
{
cout<< "EHealth =" << EHealth-Attack/2 <<endl;
EHealth=EHealth-Attack/2;
system("PAUSE");}}
cout<< "You Win!" <<endl;
system("PAUSE");
return 0;}
*I learned how to read C++ from a friend so I may have been taught wrongly
Topic archived. No new replies allowed.