#include <stdio.h>
#define SIZE 10

/*
 * Program to average numbers from an array after reading in data from
 * a file. 
 * Terry Harvey CISC 105 section 98 TA Janet
 */

int main(){

    int data[SIZE];
    int i = 0;
    double average, total = 0;
    
    FILE* spam; /* This is type "file pointer"; the var name is "spam". */

    spam = fopen("data", "r");/* Opens a file called "data" for reading */

    /* Try running this without a file called "data" in the same
       directory. What happens? */

    for (i = 0; i < SIZE; i++)
        fscanf(spam, "%d", &data[i]);

    for (i = 0; i < SIZE; i++)
        printf("%d ", data[i]);

//
//    for (i = 0; i < SIZE; i++){
//      total = data[i] + total;
//      printf("running average is %lf\n", total / (i+1));
//    }
//
//    average = total / SIZE;
//
//    printf("The average is: %lf\n", average);

    return 0;
}
