CSCI 150, Spring 2003
Home | | Course Schedule | | Assignments | | Lecture NotesHomework 5 solution
{Author: Brenda Student Section: CSCI 150, Section 1 Date: 3/14/03 Assignment: Homework 5 Purpose: Print out a HolyCross banner} program banner; {print out number spaces} procedure printSpaces( number : integer); var count : integer; {counter in for loop} begin for count := 1 to number do begin write(' '); end; end; {end of printSpaces} {Procedure for drawing an H with number spaces in front} procedure draw_h( number : integer ); begin printSpaces(number); write('HHHHHHHHHHHHHHHH'); writeln(); printSpaces(number); write(' HHH '); writeln(); printSpaces(number); write(' HHH '); writeln(); printSpaces(number); write('HHHHHHHHHHHHHHHH'); writeln(); writeln(); end; {end of draw_h procedure} {Procedure for drawing an o with number spaces in front} procedure draw_o( number : integer ); begin printSpaces(number); write(' ooo '); writeln(); printSpaces(number); write('o o'); writeln(); printSpaces(number); write('o o'); writeln(); printSpaces(number); write(' ooo '); writeln(); writeln(); end; {end of draw_o procedure} {Procedure for drawing an l with number spaces in front} procedure draw_l( number : integer ); begin printSpaces(number); write('llllllllllllllll'); writeln(); printSpaces(number); write('ll'); writeln(); writeln(); end; {end of draw_l procedure} {Procedure for drawing a y with number spaces in front} procedure draw_y( number : integer ); begin printSpaces(number); write(' YYYY'); writeln(); printSpaces(number); write(' YYY'); writeln(); printSpaces(number); write('YY YYY '); writeln(); printSpaces(number); write('YYYYYYYYYYY'); writeln(); writeln(); end; {end of draw_y procedure} {Procedure for drawing a C with number spaces in front} procedure draw_c( number : integer ); begin printSpaces(number); write(' CCCCCCCCCCCCCC '); writeln(); printSpaces(number); write('CCC CCC'); writeln(); printSpaces(number); write('CC CC'); writeln(); printSpaces(number); write('CCC CCC'); writeln(); writeln(); end; {end of draw_c procedure} {Procedure for drawing an r with number spaces in front} procedure draw_r( number : integer ); begin printSpaces(number); write('rrrrrrrrrr'); writeln(); printSpaces(number); write(' rr'); writeln(); printSpaces(number); write(' rr'); writeln(); printSpaces(number); write(' rr'); writeln(); writeln(); end; {end of draw_r procedure} {Procedure for drawing an s with number spaces in front} procedure draw_s( number : integer ); begin printSpaces(number); write('sss sssss'); writeln(); printSpaces(number); write('s s s'); writeln(); printSpaces(number); write('sss ss ss'); writeln(); printSpaces(number); write(' ssss ss '); writeln(); writeln(); end; {end of draw_s procedure} begin draw_h(10); draw_o(12); draw_l(10); draw_y(5); draw_c(10); draw_r(12); draw_o(12); draw_s(12); draw_s(10); end. {end of banner program}