Who are we kidding? No one in industry would be writing a fluid tracker (SPA 1) in C++; you would be modifying an old C program. This captures how to do this with strings and structs.
You are being given the start of a program that reads that data into an
array of structures, makes a pass over the data classifying which would be
an output, and then a final pass computing the over/under. Recall that the
code will print a message only if the output is a liter or more; there are
no messages for fluid retention (an intake imbalance). Fill in the TODOs,
starting with event.h
, then readevents.c
, and
finally reportio.c
. The main.c
that ties this all
together has been given to you. Note that all of the code compiles
initially (but does nothing when run).
The source files are
in iostruct.zip
. You should be able
to load this directly into CLion, and it should build with no errors. If
CLion prompts to recreate the project, let it. If the project is not
created correctly, you can create a new C executable project,
selecting C-17 as the language, and copy the .c
and .h
files to it. Test your code on the second test
input, 2.in
in the .zip
project file. Remember to
configure the run configuration to set the input to the text file!
Submit all files but main.c
to esubmit
as 5struct. That is,
submit event.h
, readevents.c
,
and reportio.c
. You can submit any file as the "main", just
don't submit main.c
. While this is an SPA, your code will be
graded for correctness only, not style. Perhaps the "structured" part of
this SPA is the C structs! You can get help from other students in
moderation, but do submit your own solution.