I have 3 files i need to read in one program.. the files contain the same type of information.. numbers, but in each file the numbers are different.
i wrote a program to read one file and manipulate the information in it, but i need to get this program to somehow read the other two files right after this one, and i'm unsure of what i need to do. this is it...
could i write a function to read these 3 files??
int beachnum, sampnum, s;
double samp,total, avg;
ontariofile = fopen ("ontario.txt", "r");
while (fscanf (ontariofile, "%d", &beachnum) != EOF)
total = 0;
fscanf (ontariofile, "%d", &sampnum);
for (s = 1; s <= sampnum; ++s)
fscanf (ontariofile, "%lf", &samp);
total = total + samp;
avg = total / sampnum;
if (avg > 50)
printf ("%d: open\n", beachnum);
else if (avg < 50)
printf ("%d: closed\n", beachnum);
if (sampnum <3)
printf ("%d: insufficient data\n", beachnum);