C++ using eclipse Only having trouble with E so far I have: Void copyTourType(to
ID: 2247612 • Letter: C
Question
C++ using eclipse
Only having trouble with E
so far I have:
Void copyTourType(tourType& tType1)
{
tourType, tType2;
tType2<<tType1.cityName;
tType2<<tType1.distance;
tType2<<tType1.travelTime.hr;
tType2<<tType1.travelTime.min;
tType2<<tType1.travelTime.sec;
8. Suppose that you have the following definitions: (8) struct timeType struct tourType int hr double min; int seci string cityName: int distance; timeType travelTime 1: 1a a. 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. c. e Write the definition of a void function with a reference parameter of type tourType to input data in a variable of type tourType.Explanation / Answer
In option E it says void function with reference parameter of type tourType to input data
So, In function call we need to send the address and in function definition a pointer is used so that whatever the address it send , the function will have pointer to it
Function Call would be :
copyTourType(&tType1)
Function defintion :
Void copyTourType(tourType *tType1)
{
COUT<< tType1 -> cityName; // The method to access the structure data (or)
COUT<< (* tType1). distance; // The method to access the structure data ,Both are equivalent
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.