#include <cstdlib>
#include <iostream>
#include <sstream>
usingnamespace std;
int main(int argc, char *argv[])
{
intlong persona = 1000; // persona life yourself
intlong personb = 1000; // personb life yourself knife attack
int hit = 0;// how much damage your going to hit for
int hit1 =0; // how much damage harry hits for
int name; // person who is playing name
int choose; // choose gun or knife
int gun; // gun
int knife; // knife
int attackstage = 1; // attacking stage
int random_counter;// amount of damage withing the range
string mystr;
cout << "welcome to a basic battle system" << "\n";
cout << "Please enter your name: ";
getline (cin,mystr);
stringstream(mystr) >> name; // enter your name
cout << "\n";
cout << "You have two weapons that you can choose from" << "\n";
cout << "Knife has a more steady damage rate of 200-250" << "\n";
cout << "while the gun has a more random danage rate of 100-400" << "\n";
cout << "\n";
cout << "Enter 0 for knife or 1 for gun" << "\n";
cout << "what would you rather use gun or knife: " ;
cout << "\n"; // storyline
getline (cin, mystr);
stringstream(mystr) >> choose; //choosing weopen
if (choose ==0) {// knife fight
cout << "\n";
cout << "You have choosen knife" << "\n";
cout << "your about to fight for your life against the deadly Harry " << "\n";
cout << "He has also choosen a knife to attack, winner takes all the bottle caps" << "\n";
cout << "\n"; //storyline
do{
cout << "attacking round: " << attackstage << "\n"; // what round in the fight it is
attackstage = attackstage +1; // adds another round to a attack
srand((unsigned)time(0));
int random_integer;
int lowest=200, highest=250;
int range=(highest-lowest)+1;
for(int index=1; index<2; index++)
random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0));
hit = hit + random_integer;
cout << "You hit Harry for: " << hit << "\n";
personb = personb -hit;
cout << "Harry now have: " << personb << " life ponits left" << "\n";
cout << "\n";
int random_integer1;
for(int index=1; index<2; index++)
random_integer1 = lowest+int(range*rand()/(RAND_MAX + 1.0));
hit1 = hit1 + random_integer1;
cout << "Harry hits you for: " << hit1 << "\n";
persona = persona -hit1;
cout << "You now have: " << persona << " life ponits left" << "\n";
cout << "\n";}
}while (persona <= 0);
elseif (choose == 1){ // gun fight
cout << "\n";
cout << "You have choosen Gun" << "\n";
cout << "your about to fight for your life against the nerd raged Scott " << "\n";
cout << "He has also choosen a gun to attack, winner takes all the bottle caps" << "\n";} //storyline
system("PAUSE");
return 0;
}