I have had some difficulty figuring out this one a bit. I think I have the last bit figured out (printing out to the screen). However, everything else has been causing problems for me. I am not sure, so any input from anyone would be greatly appreciated! This is what the program must do:
Create a flowchart and write a complete C++ program that declares a 2 dimensional integer array of size 10 rows and 10 columns. The program should use two nested for loops to fill the array as follows. If the row number is divisible by the column number then put in the put the row number in the cell, otherwise put the column number in the cell. The program should then use nested for loops to print the array in table form to the screen.
This is what I have so far:
#include <iostream>
using namespace std;
int main()
{
int A[10][10], row, column;
for (row=0; row<10 && row%column == 0; ++row)
{
A[row][column]=row;
for (column=0; column<10 && row%column != 0; ++column)
{
A[row][column]=column;
}
}
for (row=0; row<10; ++row)
{
for (column=0; column<10; ++column)
{
cout<<A[row][column]<<" ";
}
}
return 0;
}
Thanks again and any input would be great!