Here's the code. I'm trying to read data from a text file and put it into an array... I'm trying to do this using a function.... can anyone please help..... it's not running. There's an error somewhere....
int main()
{
float readFloat(std::ifstream& readFile)
{
float holdData = 0;
while(holdData != (-(holdData)))//error checking
{
readFile >> holdData;
return holdData;
}
}
float rainfallData[12] = {0.0F};
int i; // loop counter
ifstream myfile ("rainfall.txt");
if( myfile.is_open() )
{
i = 0;
while( i < 12 && myfile >> holdData[i] )
i++;
}
void readFloatArray(std::ifstream& readFile, float *Array, const float Size)
{
float index = 0;
//while index is not equal to Size AND !readFile.fail
// Array[index] equals readInt(readFile);
// ++index;
}
}