Homework Assignment 6
Assigned: Monday,Feb 24, 1997.
Due: Monday, Mar 5, 1997.
Read: Chapter 6 in Staugaard. Review chapters 1-7 for the
Midterm Exam.
Program:
-
-
BoxOfStarsII.C:
Write the program BoxOfStarsII.C
which prompts for two integers
called starCount and lineSize and prints starCount asterisks (*)
on several lines if necessary, filling each line except the
last with lineSize asterisks on it. The last line can have fewer
than lineSize asterisks.
Use looping constructs, not recursion, to write this program
Your program should work for all integer inputs, exiting with a
message if the user inputs a non-positive lineSize or a negative
starCount.
For example:
Enter starCount: 12
Enter lineSize: 5
*****
*****
**
-
TriangleOfStarsII.C:
Write the program TriangleOfStarsII.C which prompts for the
integer called baseSize and prints asterisks (*) baseSize on the
first line, baseSize-1 on the second line, and so on, until one
asterisk on the baseSize-th line.
Use looping constructs, not recursion, to write this program.
Check and exit if the user inputs a negative integer.
For example:
Enter baseSize: 4
****
***
**
*