Answered step by step
Verified Expert Solution
Question
1 Approved Answer
As presented in the previous questions figure, you are expected to copy objects from v 1 and v 2 to each other rather than integer
As presented in the previous questions figure, you are expected to copy objects from and to each other rather than integer values. In this question, you are asked to write a program that performs certain operations on vectors of objects. The program should include the following components:
A A 'human class with the following specifications:
Two public member variables: 'heightnamea string
A constructor that takes two parameters: an integer for the 'height' and a string for the 'name'. The constructor should have default values of for the 'height' and an empty string for the name
A 'display member function that prints the 'name' and to the console.
B A function named human objects as parameters by reference. The function should perform the following operations:
Check if the sizes of the two vectors are equal.
If they are, iterate over the first six elements of the vectors.
For the first three elements, copy the value from the corresponding element in the second vector to the first vector.
For the next three elements, copy the value from the corresponding element in the first vector to the second vector.
C In the 'main function:
Create two vectors of objects, vv with specific values.
vector
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started