Hey I'm been working on the standard magic square program. I'm starting to have some trouble and can't get any further then where I left off. I am sooo close, can anyone help me out?
Code:#include <iostream> using namespace std; typedef int square[25][25]; square magic = {0}; void gen_Array (square, int); int main() { int size = 0; cout << "Please enter the size of the magic square: " << endl; cin >> size; while ((size % 2) == 0) { cout << "Please enter the size of the magic square: " << endl; cin >> size; } gen_Array (magic, size) } void gen_Array (int nsquare, int nsize) { int nrow = 0; int ncol = 0; int crow = 0; int ccol = (nsize /2); int total = (nsize * nsize); square[crow][ccol] = 1; int i = 0; for (i = 2; i <= total; i++) { nrow = crow - 1; if (nrow < 0) nrow = nsize - 1 ncol = ccol + 1; if (ncol >= nsize) ncol =0; if (square[nrow][ncol] != 0) } }



LinkBack URL
About LinkBacks



