Week 7 Lab
Q&A on Material
- Any remaining questions on loops
Sign in to lab!
Exercises
Walk through these exercises and complete them as a group (if time allows):
Tracing
#include <iostream>
using namespace std;
int main()
{
int n = 15;
int total = 0;
for(int i = 1; i < n; i+=2)
{
if (i % 3 == 0)
{
total += i;
}
}
for ( ; total > 0; total--)
{
n++;
if(total % 5 == 0)
{
break;
}
}
return 0;
}
For Loop Exercises
Select one or two of the following exercises to complete as a section.
cpp/cs102/map/parabola
cpp/cs102/practice8/sumOfMultiples
Review for Midterm 1
- Review any problems from the practice set or sample exam that you were unsure of
Open-ended Help
Any students with questions may stay after to get help. Anyone else may leave at this stage.