#include <stdio.h>
#include <string.h>

/*
 * Program to 
 * Terry Harvey CISC 105 section 98 TA Janet
 */
typedef struct {
    int day;
    int month;
    int year;
    char city[29];
    double hiTemp;
    double loTemp;
} Record;

Record readRecordFromLine(char data[], int size);

void printRecord(Record r);

int main(){

    int x;
    Record r1;
    char line[80];

    Record allData[10000];

    allData[1].hiTemp = 98;
    strcpy(allData[1].city, "blah");

    r1.day = 1;
    r1.hiTemp = 56.78;

    strcpy(r1.city, "Elsmere");

    printf("r1.hitemp is %lf\n", r1.hiTemp);
    printRecord(r1);
    printf("r1.hitemp is %lf\n", r1.hiTemp);
    printf("r1.city in main is %s\n", r1.city);

    printf("r1 size is: %d\n", sizeof(r1));

    printf("Enter some data\n");
    fgets(line, 80, stdin);
    allData[0] = readRecordFromLine(line, 80);

    return 0;
}

Record readRecordFromLine(char data[], int size){
    Record temp;
    strcpy(temp.city, data);
    return temp;
}

void printRecord(Record r){
    r.hiTemp +=10;
    r.city[1] = 'X';
    printf("%s\n", r.city);
    printf("%lf\n", r.hiTemp);
    return;
}
