hi,
im just working on a program write now which im having some difficulty with. this is probably because i dont think i fully understand while loops and counts and stuff.i started writin the code jus for the hot days part of the question to test if the concept was working but even that hasnt worked and also EQF is coming up as an error.any help and suggestions would be greatly appreciated!thank you so much.
heres the Q problemand underneath is my code)the problem is as follows:
write a program to process a collection of daily high temperatures.your program should count and print the number of hot days(85 and higher),pleasant days(60-84) and the number of cold days(less than 60)
use the following datainput.txt)
55 62 68 74 59 45 41 58 60 67 65 78 82 88 91 92 90 93 87 80.
[CODE]
#include <stdio.h>
int
main(void)
{
int temperature,
temperature_input,
hot_days,
pleasant_days,
cold_days;
FILE *inp;
inp=fopen("a4q1temp.txt","r");
printf ("Temperatures\n");
temperature_input=fscanf (inp,"%d",&temperature);
while (temperature_input != EQF && temperature > 85) {
printf("%d",temperature);
hot_days=hot_days+1;
temperature_input=fscanf(inp,"%d",&temperature);
return (hot_days);
}
printf ("\nThe number of hot days (high temperature of 85 and higher) is: %d\n",hot_days);
fclose (inp);
system("pause");
return 0;
}
[CODE]