help! reading from file and computing average
hello i am about a month into a computer programming 1 class at a university...i need to write a program that gets data from a file and computes the total number,average and max and min....i've started this program, but now im stuck. im not sure how the loop goes or if i even have the beginning part right...here is my code if anyone has any suggestions or hints i would really appreciate it. thanks
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int temp, ;
int tempcount = 0;
FILE *tempsIn;
tempsIn = fopen("c:\\documents and settings\\desktop\\temps.txt", "r");
printf("Temperature Analyzer v1.1\n");
printf("\n");
printf("What file to analyze?");
if( tempsIn == NULL ) {
printf("File could not be opened ... exiting.\n");
system("pause");
exit(EXIT_FAILURE); // quit program
}
while(fscanf(tempsIn, "%2d%2lf", &temp);
if (
system("pause");
return 0;
}