Design a structure in c that contains data to model a state


In this problem, you will design a structure in C that contains data to model a state capital and write several functions that process and act on that data. The first step will be to design the StateCapital structure.

Your structure should include the following components: state name, capital name, land area, and date of union entry (the year).

A sample record of Nebraska is like: (Nebraska, Lincoln, 77358, 1867). To make using the webgrader easier for you to use on this program, a psudocode outline is provided for you below so that you know how data is to be inputed into the program.

Basically there will be two loops in the main function. The first is a for loop that lets the user enter a specified number of states that are inputed via the scanf() function from the terminal. Then the program goes into a while loop for a menu that prompts the user for choices involving the other function calls. The program exits the while loop when user selects the "Exit" option.

Implement these functions:

StateCapital *createStateCapital(const char *state_name, int date_of_statehood, const char *capital, double land_area);

StateCapital *findOldestState(StateCapital *stateCapital, int size);

StateCapital *findSmallestState(StateCapital *stateCapital, int size);

StateCapital *findYoungesgtState(StateCapital *stateCapital, int size);

StateCapital *findGreatestLandArea(StateCapital *stateCapital, int size);

StateCapital *findStateCapital(StateCapital *stateCapital, int size, char *stateName);

Structure to use:

typedef struct { char *state_name; int date_of_statehood; char * capital; double land_area; } StateCapital;

Program flow: Begin program: //programer supplied data createStateCapital() createStateCapital() ... 8 //begin webgrader supplied data while true input user-choice if 1 findOldestState() print result end if if 2 findYoungesgtState print result end if if 3 findGreatestLandArea() print result end if if 4 findSmallestState() print result end if if 5 input user-choice findStateCapital() print result end if if 6 break end while memory clean up return End Program

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Design a structure in c that contains data to model a state
Reference No:- TGS02898395

Expected delivery within 24 Hours