Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- FILE *input, *output;
- float maxtemp=0, mintemp = 0, maxwind_speed=0, minwind_speed=0, maxwind_chill, minwind_chill, temp, wind_dir, wind_speed, wind_chill;
- int reals=0, counter=0;
- input = fopen("input.txt","r"); //assigning file to a variable
- while(fscanf(input,"%f %f %f %f \n", &temp, &wind_dir, &wind_speed, &wind_chill) != EOF){ //the loop will continue untill it will be the End Of File
- reals += 4;
- counter += 1;
- maxtemp = max(maxtemp, temp);
- printf("%f %f\n", maxtemp);
- }
- fclose(input);
- printf("There are %i succesfuly read real numbers.\n", reals);
- printf("Max. temperature: %2.1f C\nMin. temperature: %2.1f C\n", maxtemp, mintemp);
- return 0;
- }
- max(x, y){
- if (x < y){
- x = y;
- }
- return x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement