CSCI-1200 Lab 1 — Getting Started




5/5 - (5 votes)

Checkpoint 1
We have intentionally left a number of errors in this program so that it will not compile correctly to produce
an executable program. Don’t fix them yet!
“Submit” the buggy version of the lab code to the homework server:
Follow the instructions under the “Electronic Submission” section to zip up and submit the quadratic.cpp
and README.txt files to Lab 1. After submitting the buggy code you should receive confirmation of your
submission and be notified of the compile-time errors in the program. Note that all homeworks will require
submission of both your code and README.txt file to receive full credit.
To complete Checkpoint 1: Show one of the TAs the compiler errors that you obtained in the g++
development environment on your machine and the response from the homework submission server indicating
the same compiled errors. Also, give the TA your signed “Collaboration Policy and Academic Integrity” form
(handed out in lecture on Tuesday). Here’s another copy if you need to print it out:
Checkpoint 2
The compiler errors we have introduced are pretty simple to fix. Please do so, and then re-compile the
program. Once you have removed all of the errors, you are ready to execute the program by typing:
“Re-submit” the fixed version of the lab code to the homework server: Assuming your fixes are
cross-platform compatible, the re-submission should successfully compile and run without error. You will
need to show your successful submission to a TA. But you’re not done yet…
Using previous commands – up/down arrows, history, and !
You can use the up and down arrows of the keyboard to navigate through old commands so you don’t
have to retype them. Type “history” to view a list of recently run commands. For example, if you had
just run a “g++” command, made some file edits and wanted to re-compile, you could press the up arrow
and the “g++” command would show up as if you had just typed it. Use the “!” command to search the
recent command history and re-run commands. “!!” will re-run the previous command (same as typing
up arrow, then enter). If you want to go back 2 commands, use “!-2”. You can also search using “!”
and then a string. If you ran “!g++”, it would find the most recent command starting with “g++”, like
“g++ main.cpp -Wall -o test.exe”, and re-run it. These tricks are very useful so you don’t have to
painstakingly retype commands!
Showing a text file – cat, less, head, and/or tail
These commands can be used to print the contents of a code or plaintext file on the screen. This is useful
for checking any program output written to a text file. cat displays the whole file (it may scroll off the
screen), less shows one page of the file at a time (use space bar to see the next page), head shows the
first lines of the file, and tail shows the last lines of the file.
For the rest of this lab we will work with arrays and the logic of manipulating them. Modify the main
program so that instead of a while loop, the program will read in 5 different quadratic polynomials from
the keyboard. We will assume that all of the a coefficients are 1. So we only need to read in and store the 5
b coefficients into an integer array named b_array with 5 slots and similarly read and store 5 c coefficients
into a variable c_array. Hint: Use a for loop. After reading in all of the data, write another for loop to
find the roots for each of the 5 equations. Store the smaller root for each equation in a third array of 5 spots
named smaller_root. Note: You won’t submit this modified version of the program to the homework server!
To complete Checkpoint 2: Show the TA the results of submitting your debugged code for the one
equation program to the homework server and your debugged, extended, and tested multi-equation program
(not submitted to the server).
Checkpoint 3 will be available at the start of Wednesday’s lab.