Answered step by step
Verified Expert Solution
Link Copied!

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 v1 and v2 to each other rather than integer values. In this question, you are asked to write a C++ 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: 'heightname`(a 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 '0` 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, 'v1v2', with specific values.
vector
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

LO2.6 Explain how the market system deals with risk.

Answered: 1 week ago