CSCI 261 - Programming Concepts - Spring 2022

Lab 1F - Debugging: Fixing Errors

This lab is due by Tuesday, February 01, 2022, 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.


Errors


To gain more practice with debugging, as well as provide experience to read/fix someone else's code, you're given a starter program.

You will learn how the flow of control can be altered with different types of looping statements. 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.

Your task for this lab is to fix a program that has several errors.


Instructions


Create a new folder and call it L1F. Once you have your empty folder, open Errors.zip and copy the contents to your folder. .

The Errors.zip 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!

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.

The program contains some sections with infinite loops. Some infinite loops will cause a message to keep scrolling on your screen. For others, the cursor will just be blinking and nothing will appear (at least immediately) on your screen. You might want to challenge yourself to identify the infinite loops before you try to run the program. But running the program to see where the infinite loops occur is also acceptable.

Use all of the various methods discussed in class to identify the errors and correct them so the program runs as desired.


Test Cases


For each section, you can assume you will have a smart user that will give a valid integer greater than 1. Your task is to use multiple inputs to verify that the calculations are correct. In the comments for each section, list the input and corresponding generated output that shows your loop is working as desired.


Lab Submission


Submit your main.cpp, Makefile file(s).

You will submit your solution to this lab with the rest of Set1. Detailed instructions for doing this are posted in Assignment 1.


This lab is due by Tuesday, February 01, 2022, 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.