#include<fstream> #include<iomanip> using namespace std; ofstream outfile; int main() { outfile.open("output.txt"); int n; //intermediate variables and array information store cout << "Welcome to Magic Square Program!" << endl << endl; cout << "Enter order of the magic box: "; cin >> n; int MagicSquare[5][5]; MagicSquare[0][2] = 1; for (int x = 0; x < n; x++) { for (int y = 0; y < n; y++){ cout << setw(3) << x * y << MagicSquare[x][y]; } cout << endl; } system("pause"); return 0; }
Quote:cout << setw(3) << x * y << MagicSquare[x][y];
MagicSquare
MagicSquare[0][2]
MagicSquare[x][y] = x * y;
int *MagicSquare = new int[n*n]; //at the ende delete MagicSquare;//
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)