feat: Initial commit
This commit is contained in:
36
Laboratorio 8/Esercizio 3/Exrate.c
Normal file
36
Laboratorio 8/Esercizio 3/Exrate.c
Normal file
@@ -0,0 +1,36 @@
|
||||
// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user