how to print an N*N matrix in tabular form?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
# include<iostream>
# include<conio.h>
using namespace std;
void printarray(int arg[8][8],int length){
for (int n=0;n<length; n++){
for(int j=0;j<length;j++)
cout<<arg[n][j]<<" ";
getch();
}}
void main(){
int n=0;
int j=0;
int arr[8][8];
cout<<"["<<n<<"]["<<j<<"]"<<endl;
printarray(arr,n);
cout<<"\n";
getch();
|
Last edited on
Try this:
cout << '\t' << arg[n][j];
Last edited on