Template in C++ is a feature. We write code once and use it for any data type including user defined data types.
Given three cases :
1st case when two strings are given , print the smallest of the two strings.
2nd case when two integers are given, print the smallest of the two integers.
3rd case when two char are given , print the smallest of the two characters(lowercase).
Your task is to complete class minElement which would include a private variable say y, a constructor which would set the given value to the private variable. And a method check() which would take one parameter say x and print the min of x and y(private variable) .
The first line will contain an integer T (number of test cases). First line of each test case will contain 1 integer c. Next line will contain two strings if c is equal to 1 or will contain two integers if c is equal to 2 or will contain two char if value of c is equal to 3.
Print the lowest of the two values given.
1 < = T < = 100
1 < = c < = 3
1<= Length of strings, integers<=103
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.