Question: Program in C: Create a typedef called timeType and a struct called timeType_struct with 3 components: an integer hr, an integer min, and an integer

Program in C:

Create a typedef called timeType and a struct called timeType_struct with 3 components: an integer hr, an integer min, and an integer sec

Create a typedef called tourType and a struct called tourType_struct with 3 components: a 50 character city name, an integer distance, and a travel time of type timeType.

***Write a void function that takes a pointer parameter to a tourType struct as input and prints it.

***Write a value-returning function that prompts for all the data in a tourType and returns a value of tourType.

---Create a 3 element array of tourType

Use your function to read the data into structs in the array.

Once the array is populated, find the tour with the shortest distance and use your function to print it.

For Example:

Enter tour data for 3 cities... Enter a city name: Chicago Enter an integer distance: 300 Enter travel time as HH:MM:SS 06:00:01 Enter a city name: Pittsburgh Enter an integer distance: 600 Enter travel time as HH:MM:SS 10:30:00 Enter a city name: Miami Enter an integer distance: 500 Enter travel time as HH:MM:SS 08:00:00

Shortest Tour ------------- City name: Chicago Distance: 300 Travel time: 06:00:01 _______________________________________ Enter tour data for 3 cities... Enter a city name: Charlotte Enter an integer distance: 100 Enter travel time as HH:MM:SS 02:05:23 Enter a city name: Greenville Enter an integer distance: 25 Enter travel time as HH:MM:SS 00:30:00 Enter a city name: Clemson Enter an integer distance: 1 Enter travel time as HH:MM:SS 00:05:00

Shortest Tour ------------- City name: Clemson Distance: 1 Travel time: 00:05:00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!