Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Feb 13th, 2007, 8:35 PM   #1
gamerfelipe
Newbie
 
Join Date: Jan 2007
Location: Hershey, the sweetest place on earth
Posts: 19
Rep Power: 0 gamerfelipe is on a distinguished road
Point-of-Sale

Hello! I'm kind of new to programming so please help. I have been working on a program that would present a menu so the user can choose what they wanted. Every time they chose something the program would repeatedly display the menu as the sale is being totaled. Currently, when I try to run my program it shows a never ending loop.

#include <iostream.h>          // included heading

float totalsale (float s);

int main()
{
    int choice;
    float sale = 0.00;
    
    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;
	cout << "The current cost of your meal is " << sale << endl;
    } while (choice != 'T');
    
        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;
        }
    float totalsale (sale);
    return 0;
}

float totalsale (float function_s)
{
      return function_s;
}

I'm not completely finished with it. Could someone tell me what I'm doing wrong?
gamerfelipe is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
3d Graphics. Sane Other Scripting Languages 54 Apr 7th, 2006 10:38 PM
Add - ins for Power Point 2003 christophersong Visual Basic 0 Dec 19th, 2005 4:32 PM
How to make an array of pointers-to-char point to strings aznluvsmc C 38 Sep 21st, 2005 8:45 AM
Finding a point on a circle TooDice Other Programming Languages 15 Jun 23rd, 2005 8:56 AM
various questions on class Point methods nocturna_gr Java 1 May 7th, 2005 1:45 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:39 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC