#include <iostream>
# include <time.h>
usingnamespace std
;int main()
{int maximum;
int minimum;
int random_number;
int req_subtraction;
int current_total;
int total;
do
{
string your_name;
cout <<"What is your name?" << endl;
getline(cin,your_name);
cout << "Total Limit?" << endl; //can't go over this
cin >> total;
cout << "Max you can add?" << endl;
cin >> maximum;
cout << "Minimum you can add?" << endl;
cin >> minimum;
cout << "Required Subtraction?" << endl;
cin >> req_subtraction;
srand(time(0)); //seed the random number
int high=maximum;
int low=minimum;
do
{random_number = rand () % (high - low + 1) + low;//random number between max and min
cout << "Random Number is " << random_number << endl;
current_total += random_number - req_subtraction;
if(current_total < 0) //make so negatives equal out to zero
{ current_total = 0; }
cout << "The current total is " << current_total << endl;
}
while (current_total < total);
cout << "Would you like to try again? (yes/no)\n";
cin >> yes_no;
} while (yes_no == "yes");
cout << "Goodbye.\n";
system("pause");
return 0;
}