void fileMinMax(double* pMin, double* pMax)
{
ifstream fin("data.txt");
char c;
fin >> c >> c;
int n;
fin >> n;
for(int i=0; i < n; i++)
{
// read a number from the file
double x;
fin >> x;
if( i == 0 ) // the first time
{
*pMax = *pMin = x; // dereference!
}
else // second time or later
{
if( *pMin > x ) // do we have to update the minimum?
*pMin = x;
if( *pMax < x ) // do we have to update the maximum?
*pMax = x;
}
}
}