COSC1315 Fundamentals of Programming

Instructor:  Prof. Richard G. Baldwin

Assignment Number:  03

Non Object-Based program to pass a parameter by value with a return value.

Making certain that you comply with the General Requirements, write a C++ program that meets the following specifications:

BEGIN WRITTEN SPECIFICATIONS

This program does not require the use of Object-Based Programming Syntax.

Write a program of your choice that does the following:

  1. Displays your name on the screen.
  2. Demonstrates the most important characteristics of passing a parameter to a function by value.
  3. Demonstrates how to return a value from a function.

With respect to item 2 above, include comments at the end of your program  explaining the most important characteristics of passing a parameter to a function by value and explaining how your program demonstrates those characteristics.

With respect to item 3 above, include comments that explain how your program demonstrates how to return a value from a function.

Program Output:

Produce the output of your choice.

END WRITTEN SPECIFICATIONS

As specified in the General Requirements, copy the above specifications, including the two lines of upper-case characters and paste the specifications into a comment block at the beginning of your source code file.

Note:  Sometimes when copying C++ source code into HTML documents (like this one) the code will become corrupted.  This is particularly true for code that involves left and right angle brackets such as in:

#include <iostream>
if(x <= y){

Although Prof. Baldwin has made an effort avoid such problems, it is possible that some corruption of source code may have occurred during the creation of these HTML documents.  If you see anything that you believe might be corrupted source code, please notify Prof. Baldwin so that he can look into the problem, correct the code if necessary, and make all of the students aware of the problem.

-end-