L.A.10.1 o pictures

LAB EXERCISE

 

PICTURES

 

 

Assignment:

 

 

1.    Write a function that takes in, through its parameters, the number of rows and columns to print in a multiplication table.

 

2.    There must be a margin of row and column headings for the table.

 

3.    The answer columns should be separated by a field-width of 5 columns.

 

4.    A blank line should be inserted between the column heading and the first row of the table.

 

5.    A precondition of the procedure is that the value of the row or column will be from 1..12.

 

6.    Sample run output for printTable (4,6):

 

 

                       1           2           3           4           5           6

 

        1              1           2           3           4           5           6

        2              2           4           6           8         10         12

        3              3           6           9         12         15         18

        4              4           8         12         16         20         24

____________________________________________

 

 

7.    Write another function to print the following pyramid pattern of stars.  If the number of

       lines = 5, then:

 

    *

   ***

  *****

 *******

*********

 

 

8.    Such a function should take in, through its parameter list, the number of lines to print.  The precondition of this function, lines <= 30.

 

 


Instructions:

 

1.    The main function will consist of only 4 function calls separated by cin.get() calls.

 

main ()

{

printTable (4,6);

cin.get();                   // freezes the output screen to see the picture

printTable (11,12);

cin.get();

pyramid (10);

cin.get();

pyramid (25);

cin.get();

return 0;

}

 

2.    The cin.get() between the four function calls will hold the picture until a return key is entered.

 

3.    Your source code must include a pseudocode version of each function.  Write your pseudocode above your actual code as documentation.  Please follow the process and develop your pseudocode first, then translate it to code.  You need to practice this system of problem solving on relatively easy problems so that you can apply it to more difficult problems.