1) Declare a structure with a type name: Car containing: - ReportingMark a string of 5 or...
Question:
1) Declare a structure with a type name: Car containing:
- ReportingMark a string of 5 or less upper case characters
- Carnumber an int
- Kind could be box tank flat or other
- loaded a bool
- Destination a string with a destination or the word NONE
A destination is required if the car is loaded. If it is not loaded the destination may be either a destination or the word NONE.
Create the following functions: main * Uses new to obtain space for the data structure * Calls the other two functions * Deletes the space obtained using new input * Read all the data from the user * After all the data has been read, put all this data into the structure output * Print the data in a neat format
Put the main function first. Use the function names and field names specified above. Arrange the functions in the order listed above. Test your program with the following data: reporting Mark SP, car Number 34567, kind box, loaded true, destination Salt Lake City
2) Repeat problem 1 with the following changes:
Use class rather than struct with the type name: Car Make the data in the class Car public. Revise the input so the input function will only read the data from the user, and then it will call an additional function named setUpCar which will put the data in the object. Test with the same data.
Thermodynamics An Interactive Approach
ISBN: 978-0130351173
1st edition
Authors: Subrata Bhattacharjee