Join Peggy Fisher for an in-depth discussion in this video Solution: Ask for lunch choices, part of Learning C++.
…Okay, I hope you had fun with this challenge.…Let me show you an example of what I came up with.…Again, remember, all programmers program differently.…What I did, was I created a string menu called menuItems.…It contained, the four items that I was going to offer for lunch.…You can see I'm going to offer hotdogs, hamburgers, turkey burgers, and salad.…Now, in order to keep track of the price ratios items, I had to create a parallel…array, because my string for menu items, is not…the same data type as my double for prices.…So, I have double prices equals $1.50 which corresponds to hotdogs,…$3.00 for hamburgers, $3 for turkey burgers, and $4 for a salad.…I ask the user to choose an item from the menu.…The DoWhile loop has to print out the menu first.…Once the user makes a choice, if they chose the item number…5, which is exit, I'm going to get out of my loop.…Otherwise I'm going to ask them how many items they want, what is the quantity.…
I'm going to take the quantity, times the prices array.…Notice I had to take the choice they entered and subtract 1, because the…
- Downloading and exploring the C++ IDE
- Working with loops
- Using predefined functions
- Creating custom functions
- Creating and instantiating classes
- Working with external files
Skill Level Beginner
Q: How do I upgrade the C++ compiler on Mac OS X and Linux?
A: Refer to C/C++ Essential Training for a detailed look at installing or upgrading the C++ compiler on various platforms.
Q: The link to download the Eclipse IDE in the "Download a C++ IDE" movie doesn't work. Where can I find the IDE?
A: Short URLs are case sensitive and need to be typed in exactly as they appear. Type in or simply click http://goo.gl/CzckWp to visit the Eclipse IDE for C/C++ Developers page.
1. Getting Started
2. C++ Basics
3. Flow of Control
4. Classes and Objects
5. Data Structures
6. File Manipulation
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.