Click here to Skip to main content
15,896,372 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I keep getting red squiggly lines under my [m] and [0] near the bottom of the source code

#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;

void CreateSquare(int&n); //function to create Magic Square


int main(){

ofstream outfile;
ifstream infile;
	outfile.open("output.txt");
	infile.open("numbers.txt");
	int row, col;
	cout << "Enter order of the magic box: ";
	int n = 5;
	int ms = n * n; 
	int MagicSquare;

		int classification;
		cin >> classification;
		if (classification % 2 == 0){  //classification odd or even
			cout << "Please enter odd integers only: ";
		}
		 int m = n/2, s = n-1;
		for (int i = 1; i <= ms; i++){
			cout >> MagicSquare[m][s];
			cout >>	MagicSquare[0][2] = 1; //Putting the number 1 in top row middle column
			m++;
			s--;
		}
		for (int row = 0; row < n; row++){
			for (int col = 0; col < n; col--)
			{
				cout << MagicSquare[m][s];
			}
			
		}
	
system("pause");
	return 0;
}
Posted

1 solution

Maybe because int MagicSquare isn't an array?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900