i want to read in several 4*4 squares of numbers from a file and determines whether or not each of those squares is an increasing square.

file containing numbers

3
1 2 3 4
2 3 4 5
6 7 8 9
5 6 7 8
1 2 3 4
2 3 4 5
5 6 7 8
6 7 8 9
10 11 12 20
13 15 16 19
14 20 25 30
20 22 27 33

until now this is what i did

char fileName[100];

cout <<" please enter the name of the data file "<< endl; // prmot the user to enter the name of the datafile

cin>>fileName;   // user inputs the file
ifile.open(fileName); // ifile stream looks for the file 

ifile>>n;
cout<<"The data for "<< n << " number of contributions has been read. " <<endl; 
cout << "\n";

where n is the number in the first line of the numbers

how to put the numbers in 2-d array

This is what i have done so far
but i want the output like that
square#1:not an increasing square
square#2: increasing square
square#3: not an increasing square

please help

#include <iostream>
#include <fstream> // Header to use input and output
#include <string> 

using namespace std;

void main()

{
      ifstream ifile; // declare file stream variables
      ofstream ofile;

    int m[20][20];
	int i , j , n;
	

	char fileName[100];
	cout <<" please enter the name of the data file "<< endl; // prmot the user to enter the name of the datafile

    cin>>fileName;   // user inputs the file
    ifile.open(fileName); // ifile stream looks for the file 

	ifile>>n;
	cout<<"The data for "<< n << " squares to check. " <<endl; 
	cout << "\n";
for (i=0; i<12; i++) 
      { 
for(j=0;j<4;j++){
		ifile>>m[i][j]; 
	  }
}

for (i=0;i<12;i++)
	{
		cout << "\n| ";
		for (j=0;j<4;j++)
		{
			cout << " | ";
			cout << m[i][j];
		}
	}


ifile.close();// c;ose file stream variables
ofile.close();


}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.