Question: in c plus Complete template class Pair by defining the following methods: void Input ( ) Read two values from input and initialize the data

in c plus Complete template class Pair by defining the following methods:
void Input()
Read two values from input and initialize the data members with the values in the order in which they appear
void Output()
Output the Pair in the format "[firstVal, secondVal]"
char CompareWith(Pair* otherPair)
Return the character '<','=', or '>' according to whether the Pair is less than, equal to, or greater than otherPair
Precedence of comparisons is firstVal then secondVal
char ShowComparison(Pair* otherPair)
Compare with otherPair by calling CompareWith()
Output the two Pairs separated by the character returned by CompareWith(). Hint: Output each Pair using Output()
Note: For each type main() calls Input() twice to create two Pairs of that type.
Ex: If the input for two Integer Pairs is:
4635
the first Pair is [4,6], and the second Pair is [3,5].
Ex: If the input of the program is:
4635
4.32.14.32.1
one two three four
the output is:
[4,6]>[3,5]
[4.3,2.1]=[4.3,2.1]
[one, two]<[three, four]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!