HI everyone,
I am new the world of C and am having some problems with a class assignment.
Can anyone help?
#include <stdio.h>
#include <math.h>
#include <string.h>
#define Max_sites 10 /* maximum number of sites allowed */
typedef struct
{
int site_id_num[4]; /* id number of the site */
int wind_speed[3]; /* the wind speed in knots */
int day_of_month[2]; /* the day of the month written as dd */
int temperature[2]; /* temp in celcius */
}measured_data_t;
{
measured_data_t current_measured,
previous_measured,
blank_measured = {"", 0,0,0,0}
}
int
main(void)
{
/* DEFINE UNITS AND VARIABLES HERE!!!!!*/
int fscan_measured(FILE *filep, measured_data_t *measuredp);
/* Fills in input data into measured_data_t
* Integer returns as an indication of success or failure
* With 1 => successful input of one site
* and 0 => error encountered */
int
fscan_measured(FILE *filep, /* input - file pointer */
measured_data_t *measuredp) /* output - measured_data_t structure to fill */
{
int status;
status = fscanf(filep, "%d%d%d%d", measuredp->site_id_num
measuredp->wind_speed
measuredp->day_of_month
measuredp->temperature;
if (status == 4)
status =1;
else if (status !=EOF)
status =0;
return (status);
}
}
/*
*Opens database file measured_data_t.dat and gets data to to place until end of file is encountered
*/
void
measured_data_t[] /* output - array of data */
{
FILE *inp;
measured_data_t;
int i, status;
inp = fopen("measured_data_t.dat", "r");
i = 0;
for (status = fscan_measured(inp, &data);
status == 1 && i < Max_sites;
status = fscan_measured(inp, &data)) {
units[i++] = data
}
fclose(inp);
/*
* Compiles data and finds the average windspeed at each site ????????
*/
}
}
}