Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Declare a structure with a type name: Car containing: - ReportingMark a string of 5 or less upper case characters - Carnumber an int

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.

Step by Step Solution

3.52 Rating (145 Votes )

There are 3 Steps involved in it

Step: 1

1 Include the header file to run on visual studio include stdafxh Include the header files include include using namespace std Declare and define the structure struct Car Declare the variables string ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Document Format ( 2 attachments)

PDF file Icon
6092575265937_22931.pdf

180 KBs PDF File

Word file Icon
6092575265937_22931.docx

120 KBs Word File

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Thermodynamics An Interactive Approach

Authors: Subrata Bhattacharjee

1st edition

130351172, 978-0130351173

More Books

Students also viewed these Programming questions

Question

What is discrimination and why should it be avoided?

Answered: 1 week ago