CSCI 102 - Fall 2023 Fundamentals of Computation

Week 11 Lab

Q&A on Material

Sign in to lab!

Functions Review

Use this handout to review how to call and write functions as well as passing arguments and returning values.

Exercises

Walk through these exercises and complete them as a group (if time allows):

cpp/cs102/practice12/functionsTF

Compiling

In future homeworks we will remove the Build button and require you to compile your own code from the terminal/command line in Vocareum. Please review Unit 8 slides on Linux Compiling and Debugging. Recall, that to compile your code at the terminal on Vocareum, you will use the g++ compiler. Let’s practice using the Lab 11 (Optional) - Compiling Vocareum exercise.

The terminal prompt should look something like this:

ddd_v1_t_Iiu8_6918@runweb40527:~$

At that prompt, type the g++ command:

g++ -g -Wall -o lab11  lab11.cpp 

Recall that:

Look at the errors and warnings. Edit lab11.cpp to fix all the warnings and errors, rerunning the g++ command above until they are all fixed. (Note: Hit the ‘UP’ arrow on your keyboard to cycle through old commands such as your previous g++ command to save time and not need to type it anew each time you recompile.)

Review for Midterm 2

Midterm 2 is will require you to write 2-4 programs building from simple to more complex. The programs will require input/output, arithmetic expressions, use of if statements and loops, and potentially some very basic array operations. You will need to be able to edit code on your own laptop and then upload files to Vocareum. See the midterm 2 info page. As a group select some of the potential review questions/exercises listed on that page and attempt to code them.

Open-ended Help

Any students with questions may stay after to get help. Anyone else may leave at this stage.