Jun 29, 2014 at 2:20pm UTC
So It says; Write a function that builds the multiplication table of arbitrary dimensions
In CodeBlocks consol It will display properly, but in Microsoft Visual Studio express 2013 it won't. I mean if I am making multiplication table I pref seeing it in right way? right?
CodeBlocks =
http://gyazo.com/f9d39802b7802bddd6f4ab34160d4e1e
Microsoft Visual Studio Express 2013 =
http://gyazo.com/44a9a629533810d8761c025df6bd73c6
What can I do to fix this?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#include <iostream>
using namespace std;
int main()
{
const int size = 13;
int **multiplicationtable;
multiplicationtable = new int *[size];
for (int i = 0; i < size; i++)
{
multiplicationtable[i] = new int [size];
}
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
int result = i * j;
multiplicationtable[i][j] = result;
cout << multiplicationtable[i][j] << '\t' ;
}
}
for (int i = 0; i < size; i++)
{
delete [] multiplicationtable[i];
}
delete [] multiplicationtable;
system("pause" );
}
Last edited on Jun 29, 2014 at 2:21pm UTC
Jun 29, 2014 at 2:22pm UTC
You could output some line breaks '\n'.
Jun 29, 2014 at 2:26pm UTC
It does not display "properly" in either. It just happens that the terminal window has certain width in one case.
What you do is to print one line. Limited window width wraps the line arbitrarily.
What you want to do is to print each row of the table on separate line. You can achieve that by inserting line break after each row.
Jun 29, 2014 at 2:45pm UTC
so i used \n and now it looks perfectly fine. Thanks for replay!