Hi guys, I've been trying to make a 2D multiplication table array. So far I've got everything down but I need the headers so my times table looks something like this:
1 2 3 4 5 6 < Headers
1 1 2 3 4 5
2 2 4 6 8 10
^Headers.
Can someone help me out?
Code:
#include <iostream>
Code:
#include <iomanip>
using namespace std;
int main ()
{
for (;;)
{
int rows, columns;
system("title Assignment 1 Multiplication table edoc s'nevets");
system("cls");
cout<<"Please enter the number of rows\n"<<endl;
cin>>rows;
cout<<"\nPlease enter the number of columns\n"<<endl;
cin>>columns;
system("cls");
cout<<endl;
for (int y = 1; y <= rows; y++)
{
cout<<setw(5);
for (int x = 1; x <= columns; x++)
{
cout<<x*y<<setw(5);
}
cout<<endl<<endl;
}
cin.get();cin.get();cin.get();
}
return 0;
}