Next: Further User-defined functions in
Up: Introduction to User-defined functions
Previous: Review Questions
n
asterisks, n
being passed as a parameter to the function. Write a driver
program (a program that calls and tests the function) which uses the
function to output an m
n
block of asterisks,
m
and n
entered by the user.
n
asterisks starting in column m
. It should take two
parameters m
and n
. If the values of m
and
n
are such that the line of asterisks would extend beyond
column 80 then the function should return false and print
nothing, otherwise it should output true and print the line
of asterisks. Amend your driver program so that it uses the function
return value to terminate execution with an error message if m
and n
are such that there would be line overflow.
Think carefully about the test data you would use to test the function.