CSCI 261 - Programming Concepts (C++)

Fall 2017 - Lab 3C

Quick Links: Canvas | CS @ Mines | Cloud9 | Piazza | zyBooks

|   Home |  Contact |  Syllabus |  Assignments |  Schedule |  Resources   |
This lab is due by Tuesday, September 26, 2017 11:59 PM .

Today we're going to return to our math roots and compute some multiplication tables. First, you must prompt the user to enter a number greater than 2 and less than 50. Continue to prompt them until they enter a valid number.

Then output a multiplication table. You'll need to print out the column and row headers so we know what two values are being multiplied. Then each cell will be the result of that product. Be sure to have the numbers right aligned with enough space to have all our columns aligned.

A sample run of the program is shown below:

Enter a number: 2
Enter a number: 112
Enter a number: 7
      1    2    3    4    5    6    7
 1    1    2    3    4    5    6    7
 2    2    4    6    8   10   12   14
 3    3    6    9   12   15   18   21
 4    4    8   12   16   20   24   28
 5    5   10   15   20   25   30   35
 6    6   12   18   24   30   36   42
 7    7   14   21   28   35   42   49

Hint: You'll need a couple of loops to accomplish this task. And recall, the iomanip library will help you with aligning the columns.


Lab Submission



You will submit your solution to this lab with the rest of A3. Detailed instructions for doing this are posted in Assignment 3.


This lab is due by Tuesday, September 26, 2017 11:59 PM .
Last Updated: 09/12/17 20:10


Valid HTML 4.01 Strict Valid CSS! Level Triple-A conformance, W3C WAI Web Content Accessibility Guidelines 2.0