Guys I am completely lost....what I want to do is make a loop to where the code im about to show. The issue is I need when I type a negative number in hotdogs, tacos, etc to make me type an error message and stop the code...here is my code and if I don't text wrap right let me know and show me how to do it right
//Assignment: Lab 2
//Date: 01/22/08
#include <iostream>
#include <string>
using namespace std;
const double TACO_COST = 0.49;
const double HOTDOG_COST = 0.75;
const double DRINKS_COST = 0.99;
const double SOURCREAM_COST = 0.15;
const double TAX_RATE = 0.0725;
int sum = 0;
int count = 0;
int main ()
{
int hotdogs, tacos, tacos_with_sourcream, drinks;
double hotdogs_total_cost, tacos_total_cost, tacos_with_sourcream_total_cost, drinks_total_cost, subtotal, taxes, total_cost;
char ans;
cout << endl << "Programmed By: Bryan Kruep \n" <<endl;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
do
{
cout << "Number of Hotdogs: ";
cin >> hotdogs;
cout << "Number of Tacos: ";
cin >> tacos;
cout << "How many of those tacos with sour cream: ";
cin >> tacos_with_sourcream;
cout << "Number of drinks: ";
cin >> drinks;
cout << endl << endl << endl << "BILL";
cout << endl << "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _";
cout << endl << "\t" << hotdogs << " Hotdogs";
cout << endl << "\t" << tacos << " Tacos" << " - " << tacos_with_sourcream << " with sour cream";
cout << endl << "\t" << drinks << " Drinks";
//Calculate totals
hotdogs_total_cost = hotdogs * HOTDOG_COST;
tacos_total_cost = tacos * TACO_COST;
tacos_with_sourcream_total_cost = tacos_with_sourcream * SOURCREAM_COST;
drinks_total_cost = drinks * DRINKS_COST;
subtotal = hotdogs_total_cost + tacos_total_cost + tacos_with_sourcream_total_cost + drinks_total_cost;
taxes = subtotal * TAX_RATE;
total_cost = subtotal + taxes;
//Display output
cout << endl << endl << "Subtotal: " << subtotal;
cout << endl << "Taxes: " << taxes;
cout << endl << "Total: " << total_cost;
cout << endl;
sum = 0 ;
cout << "Another order? (Y/N)";
cin >> ans;
cout << endl << endl;
}while ( (ans != 'n') && (ans != 'N') );
return 0;
}