1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
#include <iostream>
#include <string>
using namespace std;
// #include "PIZZA.cpp" // You supply this file
class Pizza;
class PizzaStore;
//=============================================================================================
//================Pizza Class==================================================================
class Pizza
{
public:
string name;
string address;
string topping;
string temp; //declare variables name,address,topping,temp
string *next_pizza;
Pizza(string n, string a, string t) //Pizza function
{ name = n; address = a; topping = t;}
string GetName() //GetName function
{ return name;}
string GetAddress() //GetAddress function
{ return address;}
string GetIngredients() //GetIngredients function
{ return topping;}
};
//=============================================================================================
//================PizzaStore Class=============================================================
class PizzaStore
{
private:
struct inqPizza //declare our structure named inqPizza
{
Pizza name;
inqPizza *next;
}*first, *Last;
int counter;
public:
PizzaStore() //PizzaStore ***** constructor ******
{
counter = 0;
first = NULL;
Last = NULL;
}
int PizzasWaiting() //PizzasWating function
{ return counter;}
//=============having trouble here================================
void Order(string n, string a, string t) //Order function
{
inqPizza *temp;
temp->name = *new Pizza(n,a,t);
temp->next=NULL;
if(first=NULL)
{
first=temp;
Last=temp;
}
else
{
Last=temp;
}Last = temp;
}
//===============================================================
Pizza GetFirstPizza(); //GetFirstPizza function
void Deliver(); //Deliver function
};
//=============================================================================================
//================= Main Program ==============================================================
int main()
{
PizzaStore PS;
//Pizza P;
cout << PS.PizzasWaiting() << " pizzas are waiting to be delivered\n";
//--------------------------------------------------------------------
PS.Order("Rick","1234 Elm Street","Pepperoni");
cout << PS.PizzasWaiting() << " pizzas are waiting to be delivered\n";
PS.Order("Stewie","31 Spooner Street","Anchovies and Jalapenos");
cout << PS.PizzasWaiting() << " pizzas are waiting to be delivered\n";
PS.Order("Brian","31 Spooner Street","Scoobie Snacks");
cout << PS.PizzasWaiting() << " pizzas are waiting to be delivered\n";
//--------------------------------------------------------------------
while (PS.PizzasWaiting() > 0)
{
P = PS.GetFirstPizza();
cout << "\nDelivering a pizza to " << P.GetName()
<< " at " << P.GetAddress()
<< " with " << P.GetIngrediants() << endl;
PS.Deliver();
cout << PS.PizzasWaiting() << " pizzas are waiting to be delivered\n";
}
cout << endl << endl << endl;
system("pause"); return 0;
}
|