Join Peggy Fisher for an in-depth discussion in this video Loops, part of Up and Running with C++.
…When testing the programs we've written so far, we had…to build and run the program, each time with different values.…It's not hard when we only have a few test cases.…But what happens when we want to test 100 values or maybe even 1,000?…Or maybe we don't even know how many times we need to run the program?…Fortunately, we have several ways to repeat a block of code.…C++ has three types of loops.…The first is a do, some block of code, while some condition is true.…Note that this particular type of loop always executes at least once.…
The while loop is set up to repeat as long as a conditional statement is true.…And the for loop executes for a predetermined number of times.…Let's start out with a while example.…While some condition is true.…If we took out a simple loan of $5000, how many months…would it take to pay it back if we paid $500 per month?…Well here's a flowchart of the process.…The very top box is the decision box.…It says is the balance greater zero?…If the result of that test is true, it will add one to…
- 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.