I'am having trouble reading files. can someone tell me whats wrong with this.
Code:
#include<iostream>
#include<fstream>
int main(void)
{
int i;
int j;
int num;
int up[8] = {24,49,74,99,124,149,174,200};
int low[8] = {0,25,50,75,100,125,150,175};
int ans[8] = {0,0,0,0,0,0,0,0};
ifstream infile;
infile.open("scores.c");
for(i = 0; i <= 26; i++) // there are 26 scores to check
infile >> num;
for(j = 0; j < 8; j++)
{
if( num <= up[j] && num >= low[j])
{
ans[j]++;
break;
}
}
for(j = 0; j < 8; j++)
cout << low[j] << " - " << up[j] << " = " << ans[j] <<endl;
infile.close();
}