36 lines
573 B
C
36 lines
573 B
C
// Laboratorio 8 - Esercizio 3 - Exrate.c
|
|
// Matteo Schiff - s295565
|
|
|
|
#include <stdio.h>
|
|
#include "Exrate.h"
|
|
#include "Datetime.h"
|
|
|
|
int ExrateRead(Exrate *e, FILE *fp)
|
|
{
|
|
if (!DateTimeRead(&e->datetime, fp))
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
return fscanf(fp, " %d %d", &e->q, &e->n) == 1;
|
|
}
|
|
|
|
void ExratePrint(Exrate e)
|
|
{
|
|
if (e.n == -1)
|
|
{
|
|
puts("Quotazione non valida");
|
|
}
|
|
else
|
|
{
|
|
printf("Quotazione: %d, numero di transazioni: %d\n", e.q, e.n);
|
|
}
|
|
}
|
|
|
|
Exrate ExrateEmpty()
|
|
{
|
|
Exrate e;
|
|
e.n = -1;
|
|
e.q = -1;
|
|
return e;
|
|
} |