473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Help!!!! with my assingment

I need to make a menu for my class assignment. It needs to be for different products. 1. read in an order of a customer of three items. each item to have a code. need to define a variable. prints a output with a random customer number.
correct price for each order or a message sorry we dont carry this order.
here is what I came up with so far. I am lost now



#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;

int main()
{
float S,L,F,D;
total=0;
string mystring= "Welcome to Minter's Resturant";

cout << mystring << endl;
cout << "Enter S for Shrimp, L for Lobster, F for Fish, and D for Drink" << endl;
cout<< "Please enter order" << endl;

while ("S")
{ total= total+10.00;
}
else if ("L")
{ total=total+ 35.00;
}
else if ("F")
{total=total+ 6.00;
}
else if ("D")
{total=total+1.00;
}
cout << "Thank you customer ( randl)" <<endl;
return 0;
}
Jan 24 '07 #1
3 1406
nickyeng
254 100+
i'm not sure the one i done is suit with your requirement, but this is the simple example.

Next time use for your source code.


Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.      char choice;
  9.      double total=0;
  10.      string mystring= "Welcome to Minter's Resturant";
  11.  
  12.     cout << mystring << endl;
  13.     cout << "Enter S for Shrimp, L for Lobster, F for Fish, and D for Drink" << endl;
  14.     cout<< "Please enter order:";
  15.  
  16.     cin >> choice;
  17.     switch(choice)  {
  18.           case S:
  19.                   total= total+10.00;
  20.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  21.                   break;
  22.           case L:
  23.                   total=total+ 35.00;
  24.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  25.                   break;
  26.           case F:
  27.                   total=total+6.00;
  28.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  29.                   break;
  30.            case D:
  31.                   total=total+1.00;
  32.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  33.                   break;
  34.            default:
  35.                   cout << "We not carry this item" << endl;
  36.                   break;
  37.              }
  38.  
  39. }
  40.  
  41. cout << "Thank you customer  ( randl)" <<endl;
  42. return 0;
  43. }
  44.  
Jan 24 '07 #2
i'm not sure the one i done is suit with your requirement, but this is the simple example.

Next time use for your source code.


Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.      char choice;
  9.      double total=0;
  10.      string mystring= "Welcome to Minter's Resturant";
  11.  
  12.     cout << mystring << endl;
  13.     cout << "Enter S for Shrimp, L for Lobster, F for Fish, and D for Drink" << endl;
  14.     cout<< "Please enter order:";
  15.  
  16.     cin >> choice;
  17.     switch(choice)  {
  18.           case S:
  19.                   total= total+10.00;
  20.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  21.                   break;
  22.           case L:
  23.                   total=total+ 35.00;
  24.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  25.                   break;
  26.           case F:
  27.                   total=total+6.00;
  28.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  29.                   break;
  30.            case D:
  31.                   total=total+1.00;
  32.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  33.                   break;
  34.            default:
  35.                   cout << "We not carry this item" << endl;
  36.                   break;
  37.              }
  38.  
  39. }
  40.  
  41. cout << "Thank you customer  ( randl)" <<endl;
  42. return 0;
  43. }
  44.  
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(35) : error C2065: 'S' : undeclared identifier
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(35) : error C2051: case expression not constant
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(39) : error C2065: 'L' : undeclared identifier
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(39) : error C2051: case expression not constant
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(43) : error C2065: 'F' : undeclared identifier
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(43) : error C2051: case expression not constant
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(47) : error C2065: 'D' : undeclared identifier
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(47) : error C2051: case expression not constant
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(54) : warning C4065: switch statement contains 'default' but no 'case' labels
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(58) : error C2143: syntax error : missing ';' before '<<'
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(58) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(59) : error C2059: syntax error : 'return'
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(60) : error C2059: syntax error : '}'
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(60) : error C2143: syntax error : missing ';' before '}'
1>c:\documents and settings\welcome\my documents\visual studio 2005\projects\cake\cake\food.cpp(60) : error C2059: syntax error : '}'

I tried to run the program and this is what I got.
I will play with it some more but thanks I am really trying to learn this class
Jan 24 '07 #3
nickyeng
254 100+
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.      char choice;
  9.      double total=0;
  10.      string mystring= "Welcome to Minter's Resturant";
  11.  
  12.     cout << mystring << endl;
  13.     cout << "Enter S for Shrimp, L for Lobster, F for Fish, and D for Drink" << endl;
  14.     cout<< "Please enter order:";
  15.  
  16.     cin >> choice;
  17.     switch(choice)  {
  18.           case 'S':
  19.                   total= total+10.00;
  20.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  21.                   break;
  22.           case 'L':
  23.                   total=total+ 35.00;
  24.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  25.                   break;
  26.           case 'F':
  27.                   total=total+6.00;
  28.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  29.                   break;
  30.            case 'D':
  31.                   total=total+1.00;
  32.                   cout << "Your choice is: " << choice << ". And the price is $ " << total << endl;
  33.                   break;
  34.            default:
  35.                   cout << "We not carry this item" << endl;
  36.                   break;
  37.              }
  38.  
  39.     cout << "Thank you customer  ( randl)" <<endl;
  40.     return 0;
  41. }
  42. // new line here
  43.  
please learn C++ with beginning a learner book.
if syntax you cant fix it yourself, then you will run into wall everytime you compile a program.
good luck.
Jan 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
7
by: Snake | last post by:
Hi guys, I have question about classes. when u create class called Test. and you define variable Test c; so does this act like( a variable c of type Test pointing to an abject )? The thing that...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
7
by: McCarthy | last post by:
My assingment is to write a command line program in Unix. This program takes 3 arguments. The third argument is a generation prefix. I am suppose to print out to a text file in the format of ...
3
by: hjast | last post by:
I am doing an assingment for class and I have everything execpt it will not compile. I get these errors /Users/hjast89/Desktop/test/shape.cpp:36: error: expected `}' at end of input...
1
by: Kburge03 | last post by:
Hi!! I've been working on this assingment for class where I have to design and implement an application that displays two Die objects, a button, and a label. Every time the button is pushed, the...
2
by: gcook | last post by:
Hello, I need some help! I need to genreate a set of test inputs and expected results for the currency conversion program below. I also have to use the folowing format Test Case <put number...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.