Hi,
The problem is that I have a program which processes a 2D array. One task is to find the min and max of one column (ignoring the second). Here is my code so far:
Code:
#include <iostream.h>
#include <stdlib.h>
#include <fstream>

using namespace std;

double data[4][2]; // declare 2D array for data in file.
int count;
int noOfReadings;
int counter=0;
int numberOfSpeedIntervals;
int numberOfSectors;

int main()
{
 ifstream inPutFile;//Creates stream to input file.
 inPutFile.open("c:\\grade.txt");//Opens stated file.

 if (!inPutFile)//Deals with problems opening file.
      cout << "Error opening file!" << endl;

//Finds how many lines of data there are.
int item;
while (!inPutFile.eof())
{
inPutFile >> item;
counter++;
}
const int rows = (counter/2);
cout<<"Number of rows: "<<rows<<endl;

cout<<"Please type how many intervals do you require: ";
cin>> numberOfSpeedIntervals;

cout<<"Please type how many sectors do you require: ";
cin>> numberOfSectors;

//initialise current max and min
   // find max and min
   // initialise current max and min
  double maxRead = data[i][0];
  double minRead = data[i][0];
  
  for (int i = 1; i < data; i++)
  {
  
     if (maxRead < data[i])
     {
        maxRead = data[i];
     }
     
     if (minRead > data[i])
     {
         minRead = data[i];
     }    
   
  }

      system("PAUSE");
      return 0;
}
The last lines are faulty. Any ideas?

Will