I currently have a small assignment on a programming course. I need to create a program in which the user can specify a number, let's call it n. The program then puts numbers from 1 to n on the first row as well as the first column and between them all the multiplications of the digits on the 1st row and column. I have the code working fine but I'm having trouble with the formatting. It should look like a nice clean table but it doesn't. Here's how it looks:
I tried to look info on tables on Google but couldn't really find anything useful.
Here's how the code looks like:
#include <iostream>
using namespace std;
int main () {
int multiplier = 2;
int input_number;
int row = 1;
cout << "Input number to multiply" << endl;
cin >> input_number;
cout << endl;
while ( row <= input_number ) {
cout << row;
while ( multiplier <= input_number ) {
cout << " " << row * multiplier << " ";
++multiplier;
}
multiplier = 2;
++row;
cout << endl;
}
system ("PAUSE");
}
Anyone here with any tips?