CSE110 Spring 2001
Homework #4 Hints
-
Have the program run within a pair of nested loops for the
row and column coordinatess of the screen printout, each
ranging from -r to r,
where r is the radius that the user types in.
If the sum of the absolute values of the row and column coordinates
is less than or equal to r, the coordinates should be considered inside the diamond, and the character printed to the
screen should be a pound sign.
If the sum of the absolute values of the row and column coordinates
is greater than r, a space should be printed.
-
Again, have the program run inside two nested loops for the row and
column coordinates, each ranging from -r to r,
where r is the radius that the user types in.
But now, instead of printing something if the sum of the absolute
values of the coordinates is greater than r, the program
should print something only if the sum is exactly equal to r.
The character printed should depend on the quadrant of the coordinate
point.
If the row and column indices are both positive or both negative,
the program should print a `/';
if one is positive and the other is negative, it should print a `\';
and the program should not print anything if either the row or column
coordinate is zero, in order to make the '/' and '\' faces meet.
-
Have the program increment a counter every time it reads a vowel,
and increment a different counter when it reads a consonant.
Then, when it reaches the newline character, it can compare the
two values. You shouldn't increment either counter if the character is
not a letter.