for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
{
// check if number is used, making an array for used numbers
while(sum == sumTable[j])
{
sum = rand()%n;
j = 0;
}
}
sumTable[i] = sum;
sum = rand()%n;
}
while(!picked)
{
cout << "Please choose a box that you want to keep: ";
getline(cin, boxToKeep);
for(int i = 0; i<(int)boxToKeep.size(); i++)
{
val = atoi(boxToKeep.c_str());
if(selected[val-1] == 0 && (val >= 1 && val <= 20) )
{
selected[val-1] = 1;
cout << "\nYou have chosen box number " << val /*<< " which contains " << boxes[val-1]<< ".\n\n"*/ << endl << endl;
picked = 1;
}
else
{
// ask over again
}
}
}
while(nextRound)
{
while(firstRound && nextRound)
{
cout << "Please choose a box from 1 - 20 to open,beside that you have choose and then press Enter: ";
getline(cin, choice);
for(int i = 0; i<(int)choice.size(); i++)
{
money.push_back(val-1);
selected[val-1] = 1;
cout << "You choose box number " << val << " which contains " << boxes[val-1]<< ".\n\n";
gCount++;
total++;
amount += boxes[val-1];
}
else
{
// ask over again
}
if( gCount == 5)
{
firstRound = 0;
cout << "\nFirst round is done.\n\nYou have opened a total of " << gCount << " boxes which helds a total amount of " << amount << ".\n";