I'm trying to get this code to calculate the types of pizza ordered and the total cost when "again" is != y but I keep getting these two errors.
[Error] qualified-id in declaration before '(' token (in line 88)
Error] 'customer' was not declared in this scope (line 90)
I'm not to sure where I should define customer, I thought I already did in the private class.
You can try this :
while(again=='y')
{
//.....
}
And put the total order function outside the while loop. Else it will be called everytime one loop ends.
Also did you create an Order object,or are you just placing the function body inside the main function??pls reply on wht u want to do.
Create an order class that contains a private vector of type Pizza. This class represents a customer's entire order, where the order may consist of multiple pizzas. Include appropriate functions so that a user of the order class can add pizzas to the order. Also, write a function that outputs everything in the order along with the total price. Write a suitable test program that adds multiple pizzas to an order(s).
Yes i'm trying to create a order object, but I'm to sure sure about where it goes for the assignment.
Place the class objects outside the while loop also,or you will be recreating them over n over again.
And place the function body in a .cpp file and call the class' member function through a function call.
Srry,i didnt see your third post.
Ok, all you need to do is put line 35(in your third post) outside your while loop.
//Pizza myPizza;
Rest will be fine.
And place lines 65-77 in a function body with the same name.
Like this:
1 2 3 4
void Order::customerTotal()
{ cout << "Your Total order is: " << endl; for(int i=0; i<customer.size(); i++) { customer[i].outputDescription(); cout << endl; cout << customer[i].computePrice(); cout << endl; total=total+customer[i].computePrice(); } cout << "Totat Cost: $" << total; cout << endl; }
//and when the action comes this
myOrder.customerTotal();
Here myOrder is an object of Ordrr class.
Hope tht helps.
You Cant Type anything outside main Especially after you type return 0. Period.
Place the if(...) inside the main function.
And if you may, follow the tutorials. http://www.cplusplus.com/doc/
Yeah I thought that was the case. I'll look over the tutorials.
When I put the function body outside the loop and inside the main, and the old errors return from my 3rd post.
[Error] qualified-id in declaration before '(' token (line 65)
[Error] expected '}' at end of input (line 80)
[Error] expected '}' at end of input
2nd snippet line 23: Order is your class name. You can't call a function by simply specifying the class name. You can only call a member function of a class by referencing an instance of the class. Did you mean customizedTotal?
Line 41: You declared a default constructor for Order. Where is your implementation? The error message is telling you the linker can not find the implementation of your default constructor.