Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.147.89.50
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/bmmassie/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/bmmassie/multable.cpp
//---------------------------------------------------------------
//
// Program Assignment #4
//
// Written by B M Massie
// October 2008
//
// Purpose: To produce an N x N multiplication table 
//
//---------------------------------------------------------------




// Preprocessor directives

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

// Main function

int main ()
{

//-----Variables

int
  n,           // number for multiplication table
  i,           // number for multiplication
  size;        // size of table


//-----Input

cout << "\n\nEnter size of multiplication table: ";
cin >> size;
cout << endl << size << "x" << size << " Multiplication Table" << endl;

//-----Process
while ( size < 1 || size > 20)
{
  cout << "\n\n!!! Multiplication number must be in the range of 1 -20 !!!";
  cout << "\n\nPlease re-enter a multiplication number: ";
  cin >> size;
}

cout << "     |";
for ( i = 1; i <= size; i++)
   cout << setw(4) <<  i;

cout << endl;

cout << "-----|-";   
for ( i = 1; i <= size; i++)
   cout << "----";

for ( n = 1; n <= size; n++)   
{  
  cout << "\n" << setw(3) <<  n << "  |";
  for ( i = 1; i <= size ; i++)
    cout << setw(4) << ( i * n);  
}   

cout << endl;
return 0;
}

Stv3n404 - 2023