CS201 – Spring 2001
Prof. Hartman
Homework #4
Due Friday, February 14th
by 5:00 pm
Homework to be turned in (remember that all programs must
follow the guidelines from handout #3.
1)
You are working for a very strange boss who has
decided he is afraid of the * character. Create your own multiplication
function that will return the product of two integers, without using * (the
multiply operator). Put your function in a test program to show how it works.
2)
Write a program
that, in main(), declares two integer variables and initializes them to
0. Write a function that takes two integer parameters, one by
value and one by reference. In your function, set each of the parameters to 2.
Call your function from main()
with the two variables as the two parameters. Output the values of your
variables before and after the function call.
Explain in your own words the results.
3)
Do problem number 3 on page 220 of your text.