CSCI 200 - Fall 2023
Foundational Programming Concepts & Design

Lab 2A - Loop & Function Errors

This lab is due by Tuesday, September 26, 2023, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.

Jump To: Rubric Submission

To gain more practice with loops and functions, as well as provide experience to read/fix someone else's code, your task for this lab is to fix a program that has several sections and several errors.

You will learn how the flow of control can be altered. You'll see the effect of braces in creating blocks of code, consider how complex boolean expressions are evaluated, and witness common pitfalls in programming conditional looping statements and function calls.


Instructions


The Loop & Function Errors starter program, as it currently stands, contains a number of errors related to the learning objectives stated. Your task is to correct the program, describe the type of error(s) you found, and list all the different values you need to input to test all possible cases in each section of the program. You should write this information (errors found/corrected and test values) as a comment at the top of each program section.

Compile and run the program. It is obviously not correct! Your first task is to get the program to build correctly.

Then for each section, you must correct the error or errors. To identify the errors, you may need to do some calculations. For example, if the program says it is calculating the sum of the numbers from 1 to 5 (inclusive), the result should be 15.

NOTE #1: The program contains some sections with "infinite" loops. Some infinite loops will cause a message to keep scrolling on your screen. For others nothing will appear (at least immediately) on your screen.

NOTE #2: If you get help on any of these sections, BE SURE that you understand the answer. You may see questions similar to these on the exam.


Grading Rubric


Your submission will be graded according to the following rubric:

PointsRequirement Description
0.70Fully meets specifications
0.15Submitted correctly by Tuesday, September 26, 2023, 11:59 PM
0.15Best Practices and Style Guide followed
1.00Total Points


Lab Submission


Always, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available.

Zip together your main.cpp, Makefile files and name the zip file L2A.zip. Upload this zip file to Canvas under L2A.

This lab is due by Tuesday, September 26, 2023, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.