Trying to compile a text game with little success
Thanks for any help
Jon
<pre>
#include <iostream>
using namespace std;
int main()
{
int d1;
int samt, lamt, camt, pamt;
int sugst, lemst, cupst, pitst;
int pitchers;
float bank, stot, c1, s1, bankst;
char mat, prod;
cout << "Welcome to the game of Lemonade" << endl;
cout << "" << endl;
cout << "Directions:" << endl;
cout << "1. The game can be played in five day increments." << endl;
cout << "2. You currently have $10 dollars in start up money for your stand." << endl;
cout << "3. See how much money you can make and good luck." << endl;
cout << "" << endl;
cout << "How many days would you like to sell lemonade for (pick 1 thru 5)? ";
cin >> d1;
while (d1 <= 5);
do
{
switch (d1)
{
case 1:
cout << "You have chosen to play for 1 day " << endl;
break;
case 2:
cout << "You have chosen to play for 2 day's " << endl;
break;
case 3:
cout << "You have chosen to play for 3 day's " << endl;
break;
case 4:
cout << "You have chosen to play for 4 day's " << endl;
break;
case 5:
cout << "You have chosen to play for 5 day's " << endl;
break;
default:
cout << "The number " << d1 << "is not valid. " << endl;
cout << "Please choose again. " << endl;
break;
}
}
cout << "Would you like to shop for materials? (Enter y or n) ";
cin >> mat;
if ((mat == 'N') || (mat == 'n')) cout << "You have no supplies to make lemonade." << endl;
break;
if ((mat == 'Y') || (mat == 'y'))
for (mat=1;mat<=1;mat++)
{
cout << "" << endl;
cout << "Welcome to the supermarket." << endl;
cout << "" << endl;
cout << "1. Here is the list of items you may buy." << endl;
cout << "2. Select a number and then select the" << endl;
cout << " amount you want to buy." << endl;
cout << "" << endl;
cout << "(1) Sugar @ 20 Cents per bag. " << endl;
cout << " 1 bag will make 1 pitcher " << endl;
cout << "" << endl;
cout << "(2) Lemon @ 1 Dollar per bag. " << endl;
cout << " 1 bag will make 1 pitcher " << endl;
cout << "" << endl;
cout << "(3) Cups @ 10 Cents per package. " << endl;
cout << " 1 Package contains 20 cups and" << endl;
cout << " will be enough for 1 pitcher" << endl;
cout << "" << endl;
cout << "(4) Pitcher @ 1 Dollar per pitcher. " << endl;
cout << " The more pitchers you have, the " << endl;
cout << " more money you can make" << endl;
cout << "" << endl;
cout << "Select a product by entering 1, 2, 3, or 4: ";
cin >> prod;
}
bank = 10;
while (prod = 1)
{
cout << "" << endl;
cout << "How many bags of SUGAR would you like? ";
cin >> samt;
sugst = samt * .20;
{
if (sugst > bank)
cout << "You dont have enough money. Please select another amount." << endl;
cout << "How many bags would you like? ";
cin >> samt;
if (sugst < bank)
cout << "Would you like to purchase another product? (Enter y or n)";
cin >> mat;
}
}
while (prod = 2)
{
cout << "" << endl;
cout << "How many bags of LEMONS would you like? ";
cin >> lamt;
lemst = lamt * 1;
{
if (lemst > bank)
cout << "You dont have enough money. Please select another amount." << endl;
cout << "How many bags of LEMONS would you like? ";
cin >> lamt;
if (lemst < bank)
cout << "Would you like to purchase another product? (Enter y or n)";
cin >> mat;
}
}
while (prod = 3)
{
cout << "" << endl;
cout << "How many packages of CUPS would you like? ";
cin >> camt;
cupst = camt * .10;
{
if (cupst > bank)
cout << "You dont have enough money. Please select another amount." << endl;
cout << "How many packages of CUPS would you like? ";
cin >> camt;
if (cupst < bank)
cout << "Would you like to purchase another product? (Enter y or n)";
cin >> mat;
}
}
while (prod = 4)
{
cout << "" << endl;
cout << "How many PITCHERS would you like? ";
cin >> pamt;
pitst = pamt * 1;
{
if (pitst > bank)
cout << "You dont have enough money. Please select another amount." << endl;
cout << "How many bags would you like? ";
cin >> pamt;
if (pitst < bank)
cout << "Would you like to purchase another product? (Enter y or n)";
cin >> mat;
}
}
bankst = sugst+lemst+cupst+pitst;
bank = bank - bankst;
cout << "You can proceed to your Lemonade Stand.";
cout << "";
cout << "You have purchased the following supplies ";
cout << samt << "bag(s) of sugar ";
cout << lamt << "bag(s) of lemons ";
cout << camt << "package(s) of cups ";
cout << pamt << "pitcher(s) ";
stot = (samt >= 1, lamt >= 1, camt >= 1, pamt >= 1);
cout << "Lets go make some lemonade. ";
cout << "";
cout << "Welcome to day 1 ";
cout << "";
cout << "How many pitchers would you like to make? (enter 1 thru 5) ";
cin >> pitchers;
while (pitchers == 1)
{
if (samt >= 1 && lamt >= 1 && camt >= 1 && pamt >= 1)
cout << "You have made one pitcher of lemonade. ";
}
while (pitchers == 2)
{
if (samt >= 2 && lamt >= 2 && camt >= 2 && pamt >= 2)
cout << "You have made two pitchers of lemonade. ";
if (samt <= 2 && lamt <= 2 && camt <= 2 && pamt <= 2)
cout << "You must pick another amount. ";
}
while (pitchers == 3)
{
if (samt >= 3 && lamt >= 3 && camt >= 3 && pamt >= 3)
cout << "You have made three pitchers of lemonade. ";
if (samt <= 3 && lamt <= 3 && camt <= 3 && pamt <= 3)
cout << "You must pick another amount. ";
}
while (pitchers == 4)
{
if (samt >= 4 && lamt >= 4 && camt >= 4 && pamt >= 4)
cout << "You have made four pitchers of lemonade. ";
if (samt <= 4 && lamt <= 4 && camt <= 4 && pamt <= 4)
cout << "You must pick another amount. ";
}
while (pitchers == 5)
{
if (samt >= 5 && lamt >= 5 && camt >= 5 && pamt >= 5)
cout << "You have made five pitchers of lemonade. ";
if (samt <= 5 && lamt <= 5 && camt <= 5 && pamt <= 5)
cout << "You must pick another amount. ";
}
c1 = (pitchers*20);
s1 = (pitchers*5);
bank = (bank+s1);
cout << "Day 1 is now finished. ";
cout << "Your amounts made for the day where: ";
cout << "";
cout << "Pitchers made = " << pitchers;
cout << "Cups sold = " << c1;
cout << "Total sales = $" << s1;
cout << "You now have $", bank , "in your bank account" ;
return 0;
}
</pre>

