Solved–Lab 8– Solution

$30.00 $19.00

Introduction: Last week we started an investigation of functions and their uses in programming. Functions though, are much broader than what we were able to cover in a single lab. This week we will focus of refining our understanding of functions. It is a good practice to carefully define the effects that a function will…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

Introduction:

Last week we started an investigation of functions and their uses in programming. Functions though, are much broader than what we were able to cover in a single lab. This week we will focus of refining our understanding of functions.

It is a good practice to carefully define the effects that a function will have when it is used by another coder (or by you at some other time). Every function in c++ takes zero or more input parameters, zero or one return values, and any number of side effects. A side effect is any change which is caused in the calling function by a called function. To understand side effects it is important to understand that some variables are passed by value (which cannot change the original variable) and some are passed by reference (which can affect the original variable). Arrays are always passed by reference.

The purpose of today’s lab is to explore function parameters and returns.

Directions:

1- Download​​the yourName_lab8.cpp file from TRACS. Give the file an appropriate name and open it in Code::Blocks. Right click the file on TRACS and select “Save link as” to get the file.

2-Fill in the standard header for this lab:

//Your Name

//CS1428

//Lab 8

3- Several helper functions have already been written for you. Fill in the main function as directed by the comments. Do not make any changes to the helper functions.

4- Build and run your code. Fix any errors. Your output should look something like this:

5- Submit your .cpp file to TRACS. You can leave when you’re donne.