subject
Engineering, 15.02.2020 01:52 msalecora

C++ Programming

Create a class template Pair that houses 2 items of datatype T.
Whatever datatype stored needs to implement the < and > operators.
There should be two private data attributes called item1 and item2.
There should be the following public methods.

A 2 argument constructor.
A method getMax that returns the larger of the two stored items.
A method getMin that returns the smaller of the two stored items.
A method setItems that takes in two constant items by reference and sets item1 and item2 to them.
A method getItem1 that returns item1.
A method getItem2 that returns item2.

Make a appropriate methods const so they don't alter item1 or item2 if not needed.

You should have a Pair. h and Pair. cpp file.

Create a pairTest. cpp file with a main() that creates two pairs, one that houses ints an one that houses strings.
Test all the methods for these two Pairs in your main and display the results.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 14:10
When at a point two solid phase changes to one solid phase on cooling then it is known as a) eutectoid point b) eutectic point c) peritectic point d) peritectoid point
Answers: 3
question
Engineering, 04.07.2019 18:10
Aloaded platform of total mass 500 kg is supported by a dashpot and by a set of springs of effective stiffness 72 kn/m. it is observed that when the platform is depressed through a distance x = 12.5 cm below its equilibrium position and then released without any initial velocity; it reaches its equilibrium position in the shortest possible time without overshoot. find the position and velocity of the loaded platform 0.10 sec. after its release. if a further load of 400 kg is added to the platform, find, i) the frequency of damped vibrations, and i) the amplitude of vibration after 2 complete oscillations, given that the initial amplitude is 15 cm.
Answers: 1
question
Engineering, 04.07.2019 18:10
Water at 55c flows across a flat plate whose surface temperature is held constant at 95c. if the temperature gradient at the plate's surface for a given value of x is 18 c/mm, find a) local heat transfer coefficient. b) heat flux
Answers: 3
question
Engineering, 04.07.2019 18:10
Manometers are good examples of measuring instruments, nowadays they are not as common as before. a)-capacitive probe gauges b)-gravitational gauges deformation ) gauges d)-digital gauges
Answers: 1
You know the right answer?
C++ Programming

Create a class template Pair that houses 2 items of datatype T.
Wh...
Questions
question
Health, 29.10.2020 19:50
question
Mathematics, 29.10.2020 20:00
question
English, 29.10.2020 20:00
question
Mathematics, 29.10.2020 20:00
Questions on the website: 13722360