Thread: Point-of-Sale
View Single Post
Old Feb 14th, 2007, 12:38 PM   #4
gamerfelipe
Newbie
 
Join Date: Jan 2007
Location: Hershey, the sweetest place on earth
Posts: 19
Rep Power: 0 gamerfelipe is on a distinguished road
Okay, with a few adjustments, I got it.

#include <iostream.h>          // included heading

char choice;
float sale = 0.00;

float totalsale (float s);

int main()
{
    do
    {        
    cout << "What would you like to buy from the menu.\n";
	cout << "S - Sandwich\n";
	cout << "C - Chips\n";
	cout << "B - Brownie\n";
	cout << "R - Regular Drink\n";
	cout << "L - Large Drink\n";
	cout << "X - Cancel Sale and Start over\n";
	cout << "T - Total Sale\n";
	cin >> choice;
    
    switch(choice)
        {
   	case 'S':
   	sale = sale + 2.99; 
   	break;
        case 'C':
   	sale = sale + 0.99;
   	break;
   	case 'B':
        sale = sale + 0.99;
        break;
   	case 'R':
   	sale = sale + 0.99;
   	break;
   	case 'L':
   	sale = sale + 1.29;
   	break;
   	case 'X':
        sale = 0.00;
        break;
        }
    cout << "The current cost of your meal is " << sale << endl;
    
    float totalsale (sale);
    } while (choice != 'T');
    
    if (choice = 'T');
    {
       cout << "The final cost of your meal is " << sale << endl;
    }

    return 0;
}

float totalsale (float function_s)
{
      return function_s;
}
gamerfelipe is offline   Reply With Quote