Join Peggy Fisher for an in-depth discussion in this video Solution: Make a cashier app, part of Up and Running with C++.
…Okay, I hope you enjoyed the challenge.…Let's take a look at one possible solution to this problem.…The way that I've set it up is I added two void functions.…One will print out the change, giving the…value for dollars, quarters, dimes, nickels, and pennies.…The other function I'll use to actually find those values.…I'm going to give it the total coin amount, the total…change amount, and it'll tell me the quarters, dimes, nickels, and pennies.…
In my main program, I need a variable to hold the…price of the item or the total price of the transaction.…I also need to know what the payment amount was from the customer.…I want to allow the user to be able to run this program many times,…so I created a character variable, answer, and set it equal to y to start.…I need an integer variable to represent…the dollars, quarters, dimes, nickels, and pennies.…Then I added a while loop.…I said while the answer is equal to yes.…Since the first time it will be yes, it will automatically go into…my loop and ask the user to enter the price of an item.…
- 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
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.