Looping Text based battle
I've just started this and I can't seem to get my characters attack to loop. I've tried, but the loop is confusing for me, and I was wondering if anyone could tell me or show me how to loop.
What I'm trying to loop:
Code:
while (gob > 0){
const int LOW = 6;
const int HIGH = 9;
time(&seconds);
srand((unsigned int) seconds);
attack = rand() % (HIGH - LOW + 1) + LOW;
cout<<"***Slash***"<<endl;
cout<<"The Goblin has "<<gob - attack<<" life left!"<<endl;
}
As you can see I already tried while to loop it.
Btw, I am doing this in Visual Studio.