![]() |
| ||
| I Need Help with Cases in C++. I am gonna start off saying that I am new to C++, and I have little programming knowledge (just Q Basic, and it has been a while since I have used that), and I need help on an assignment in my C++ class. We have to use a case function to collect information for an order and display the total, but I have no clue how to get the case to work at all. I am sure the solution is simple, but as I have said I really do not know much about what I am doing. And... here is the code: double S=2.50; I already have the int menu() function working fine, it is the case stuff I am struggling with. |
| ||
| Re: I Need Help with Cases in C++. Quote:
Hmm you are using the switch syntax wrong...try this: switch(tolower(choice)) Also, you should either be passing choice an argument, or have a cin input a char to use in the switch statement. Perhaps have menu() return a char, and pass it to choices for testing. Here's what I mean : #include <iostream> Don't expect this to compile; I didn't test it. But try and learn from it, as you had alot of syntax errors! |
| ||
| Re: I Need Help with Cases in C++. Thanks. I finally got it figured out and working right... somehow. |
| All times are GMT -4. The time now is 4:03 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC