Wave print and array formation

my code is not running properly . there is no error still output is not perfect

save your code at https://ide.codingblocks.com/ and send the link generated

Modified Code

for(int row=0;row<m;row++){
for(int col=0;col<n;col++){
a[row][col]= val;
val=val+1;
cout<<a[row][col]<<" ";
}
cout<<endl;
}
although it is not correct way to fill the array but if you want…
only change you have to do is instead of row<n-1 use row<n similarly for col