i would love some feedback on my assignment and i appreciate all the replys!

And also if i in your opinion accomplish the extra credits, thanks !

**Requirements:**

Use nested for-loop to find the sum of each row and column.

DON'T compare each sum == 15. DON'T assume the desired total is 15.

Display the programmer info at the beginning of the output

Include the function prototypes before the main()

All functions definitions should be after the main()

**[Extra Credits – 25 points]**

bool validateArray(const int array[][COLS], int rows)

#include <iostream> #include <iomanip> #include <ctime> using namespace std; const int COLS = 3; const int ROWS = 3; bool checkLoShuSquare(const int arr[][COLS], int rows); void showArray(const int [][COLS], int); void fillArray(int arr[][COLS], int rows); bool validateArray(const int arr[][COLS], int rows); void programmerInfo(); int main() { int LoShu[ROWS][COLS] = { {4, 9, 2}, {3, 5, 7}, {8, 1, 6}}; int square1[ROWS][COLS] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; int square2[ROWS][COLS] = { {1, 4, 7}, {2, 5, 8}, {3, 6, 9}}; int randomS[ROWS][COLS]; programmerInfo(); cout << "**Test the first square**\n"; showArray(LoShu,COLS); if(validateArray(LoShu,ROWS)!=1){ cout << "It is NOT a 3 x 3 array contained the numbers 1~9 exactly.\n"; } if(checkLoShuSquare(LoShu, ROWS)==1){ cout << "It is a Lo Shu Magic Square!\n"; } else{ cout << "It is NOT a Lo Shu Magic Square!\n"; } cout << "\n**Test the second square**\n"; showArray(square1, ROWS); if(validateArray(square1,ROWS)!=1){ cout << "It is NOT a 3 x 3 array contained the numbers 1~9 exactly.\n"; } if(checkLoShuSquare(square1,ROWS)==1){ cout << "It is a Lo Shu Magic Square!\n"; } else{ cout << "It is NOT a Lo Shu Magic Square!\n"; } cout << "\n**Test the third square**\n"; showArray(square2, ROWS); if(validateArray(square2,ROWS)!=1){ cout << "It is NOT a 3 x 3 array contained the numbers 1~9 exactly.\n"; } if(checkLoShuSquare(square2,ROWS)==1){ cout << "It is a Lo Shu Magic Square!\n"; } else{ cout << "It is NOT a Lo Shu Magic Square!\n"; } cout << "\n**Test the random square**\n"; srand((unsigned)time(0)); fillArray(randomS, ROWS); showArray(randomS, ROWS); if(validateArray(randomS,ROWS)!=1){ cout << "It is NOT a 3 x 3 array contained the numbers 1~9 exactly.\n"; } if(checkLoShuSquare(randomS,ROWS)==1){ cout << "It is a Lo Shu Magic Square!\n"; } else{ cout << "It is NOT a Lo Shu Magic Square!\n"; } return 0; } void showArray(const int array[][COLS], int rows){ int total = 0; int colTotal[COLS+1] = {0}; for (int x = 0; x < rows; x++){ total = 0; for (int y = 0; y < COLS; y++){ cout << setw(3) << array[x][y]; total += array[x][y]; colTotal[y] += array[x][y]; } cout << endl; } } void fillArray(int arr[][COLS], int rows){ for (int i=0;i<rows;i++){ for(int z=0;z<COLS;z++){ arr[i][z] = rand() % 10; } } } bool validateArray(const int arr[][COLS], int rows){ for(int i=0;i<COLS;i++){ for(int x=0; x<rows;x++){ if(arr[i][x]<1||arr[i][x]>9) return false; } } return true; } bool checkLoShuSquare(const int arr[][COLS], int rows){ int value=0; for(int i=0;i<COLS;i++){ value+= arr[0][i]; } for(int a=1;a<rows;a++){ int var=0; for(int b=0;b<COLS;b++){ var+= arr[a][b]; } if(var!=value){ return false; } } for(int c=0;c<COLS;c++){ int var2=0; for(int d=0;d<rows;d++){ var2+=arr[c][d]; } if(var2!=value){ return false; } } for(int e=0;e<COLS;e++){ int diagLeft=0; for(int f=0;f<rows;f++){ diagLeft+=arr[e][f]; } if(diagLeft!=value){ return false; } } for(int g=2;g>0;g--){ int diagRight=0; for(int h=0;h<rows;h++){ diagRight+=arr[g][h]; } if(diagRight!=value){ return false; } } return true; } void programmerInfo(){ cout << left << setw(17) << "Programmer Name:" << setw(7) << right << "John Smith\n"; cout << left << setw(20) << "Programmer ID:" << setw(10) << right <<"1234567\n"; }