Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- /**
- * OSU CS162-W18
- *
- * Holds structures, constants, and prototypes for this assignment.
- */
- #include <cstdlib>
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <sstream>
- /**
- * The state county information.
- */
- struct county {
- // The county name
- std::string name;
- // The unemployed rate in 2007
- float unemployed_2007;
- // The unemployed rate in 2015
- float unemployed_2015;
- // The medium income
- int med_income;
- };
- /**
- * The state information.
- */
- struct state {
- // The state name
- std::string name;
- // The unemployed rate in 2007
- float unemployed_2007;
- // The unemployed rate in 2015
- float unemployed_2015;
- // The medium income
- int med_income;
- // The counties inside the state
- struct county* counties;
- // The ammount of counties inside the state
- int n_counties;
- };
- /**
- * Allocate an array of a specified number of states.
- */
- struct state *allocate_states(int);
- /**
- * Reads data for a specified number of states from an input file stream
- * into a given array
- */
- void read_state_data(struct state *, int, std::ifstream &);
- /**
- * Allocates an array of a specified number of countries.
- */
- struct county *allocate_counties(int);
- /**
- * Reads data for a specified number of counties from an input file stream
- * into a given array.
- */
- void read_county_data(struct county *, int, std::ifstream &);
- /**
- * Releases all data allocated to given array. You must make sure to call this
- * function when needed to make sure any allocated data is freed before it is
- * lost or before the program exits
- */
- void free_state_data(struct state *, int);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement