I have a class named Pizza that asks all the information and displays it properly and I have to make a class named Order that has a private vector that basically outputs the order and lets the customer order multiple pizzas. How exactly do I get there? I will post my Order.cpp and Order.h. Any help would be appreciated.
#include "Order.h"
#include "Pizza.h"
#include <vector>
#include <string>
#include <iostream>
using std::vector;
usingnamespace std;
Order::Order()
{
}
void Order::addPizza(Pizza myPizza)
{
pizza.push_back(myPizza);
}
void Order::displayOrder()
{
string name;
int phone;
cout<<endl<<"What is the name on the order? ";
getline(cin,name);
cout<<endl<<"What is the phone number on the order? ";
cin>>phone;
cout<<endl<<"The name on the order is: "<<name<<".";
cout<<endl<<"The number on the order is: "<<phone<<"."<<endl;
}
Order.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#ifndef ORDER_H
#define ORDER_H
#include "Pizza.h"
#include <vector>
using std::vector;
class Order
{
public:
Order();
void addPizza(Pizza);
void displayOrder();
private:
vector <Pizza> pizza;
};
#endif // ORDER_H