Suppose that you have the following definitions: struct timeType {    int hr;    double min;    int sec; }; struct tourType {   string cityName;   int distance;   timeType travelTime; }; Declare the variable destination of type tourType. Write C++ statements to store the following data in destination: cityName—Chicago, distance—550 miles, travelTime—9 hours and 30 minutes. Write the definition of a function to output the data stored in a variable of type tourType. Write the definition of a value-returning function that inputs data into a variable of type tourType. Write the definition of a void function with a reference parameter of type tourType to input data in a variable of type tourType.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 2SA
icon
Related questions
Question

Suppose that you have the following definitions:

struct timeType
{
   int hr;
   double min;
   int sec;

};

struct tourType
{
  string cityName;
  int distance;
  timeType travelTime;
};

  1. Declare the variable destination of type tourType.
  2. Write C++ statements to store the following data in destination: cityName—Chicago, distance—550 miles, travelTime—9 hours and 30 minutes.
  3. Write the definition of a function to output the data stored in a variable of type tourType.
  4. Write the definition of a value-returning function that inputs data into a variable of type tourType.
  5. Write the definition of a void function with a reference parameter of type tourType to input data in a variable of type tourType.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning