We'll continue our tour of C++ in this lecture, with a particular focus on three areas:
|
1: Functions
In more complex programs, it's essential to define functions to abstract away details. |
|
2: Standard Library Types
The C++ Standard Library provides a variety of container and utility types. We'll take a look at a few now, including |
|
3: Iteration
3.1
In imperative programming, loops allow us to iterate through a set of instructions multiple times as long as some condition is true. C++ has two primary looping constructs,
3.1 Exercise: Vector Sum
Fill in the blanks so that the code computes the sum of elements in the vector. If your code compiles, but you're not getting credit, try clicking the "Simulate" button to step through the code and see where it's going wrong. Sample solution…
Make sure to return to finish the video after completing the exercise!
|
|
4: Branching
4.1
The
4.1 Exercise: Vector Minimum
Fill in the blanks so that the code finds the minimum value in the vector. If your code compiles, but you're not getting credit, try clicking the "Simulate" button to step through the code and see where it's going wrong. Sample solution…
Make sure to return to finish the video after completing the exercise!
|
|
5: Logical Operations and Short-Circuit Evaluation
Sometimes we need to create compound boolean expressions using the |
|
6:
break; and continue;
Finally, a miscellaneous topic. C++ also has special |