I need to use a while loop to read in 17 floating point numbers from a data input file. The last number that would be read in would be -999.
Help would be greatly appreciated!
This is what I have so far:
char filename[80]="lab6data1.txt";
float num;
ifstream infile;
infile.open(filename);
infile >> num;
while(num == -999)
{
infile >> num;
cout << "Num = " << num;
}
while(num == -999)
will execute the following block while num is equal to -999. You want to execute it when num is not equal to -999