I'm getting the "uninitialized local variable 'data' used" on line 26 and i can't figure out why. The program is supposed to read from a file, display it (which it does), and then display the largest number (which it doesn't). Any help would be appreciated.
Thanks
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int i;
char filename[81], input_line[81];
double data[11];
cout << "Enter the file name." << endl;
cin.getline(filename, 80);
ifstream file_in(filename);
if(!file_in)
{
cout << "Error! No file!";
return -1;
}
while(1)
{
for(i=1; i<=11 && !file_in.eof(); i++)
{
file_in.getline(input_line, 80);
cout << input_line << endl;
}
if(file_in.eof())break;
{
double max = data[11];
for(i=1; i<=max; i++);
if(max<data[11])max=data[i];
cout << "The maximum Magnitude is " << max;
file_in.close();
return 0;
}
}
}