Uploaded by pitjengkhutso2003

Prac 01

advertisement
#include <iostream>
#include <string>
using namespace std;
int main() {
int budget= 100;
int invoice;
double change;
string response; int base_pizza = 40;
double additional_olives=15.50; double additional_onions=11; double additional_cheese=12.30;
double additional_salami=22;
double additional_shrimp=25.40;
invoice += base_pizza;
cout << "Welcome to Antonio's pizzeria italiana." << " \n" <<"your current budget is"<< " " <<"R"<< budget << " \n" <<"your current invoice is"<< " " <<"R" << invoice << "\n";
cout<< "Still enough for more toppings?\n.";
cin >> response; if (response == "yes")
{
cout << "any olives?.\n";
cin >> response; if (response =="yes") {
invoice += additional_olives;
}
cout << "any cheese.\n";
cin >> response; if (response =="yes") {
invoice += additional_cheese;
} cout << "any salami?.\n";
cin >> response; if (response =="yes") {
invoice += additional_salami;
} cout << "any onions.\n";
cin >> response; if (response =="yes") {
invoice += additional_onions;
} cout << "any shrimp.\n";
cin >> response; if (response =="yes") {
invoice += additional_shrimp;
} if (invoice>100 ) { cout << "Your account has been over drawn" <<" "<<"by" <<" "<< budget-invoice << "Please pick your toppings again ";} else
cout << "Thank you for picking out your topping.\n";
}
if ((invoice>99) && (invoice <100)) { cout <<"Your total invoice comes to" <<" " <<"R" << invoice <<"\n";
cout<< "here is also a free cooldrink for you";}
if (invoice < 99)
{cout <<"Your total invoice comes to" <<" " <<"R" << invoice <<"\n";
cout << " Enjoy your pizza.";
change = budget-invoice;
cout << " Your change is" <<" "<<"R"<< change; }
return 0;
}
Download