C++ Template
Submissions: 540   Accuracy:

68%

  Difficulty: Easy   Marks: 2

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) .

Input: 
The first line will contain an integer (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.

Output: 
Print the lowest of the two values given.

Constraints: 
1 < = T < = 100
1 < = c < = 3
1<= Length of strings, integers<=103

Example:
Input:

3
1
gfg spl
2
5 9
3
p s

Output:
gfg
5
p
  

** For More Input/Output Examples Use 'Expected Output' option **

Author: saksham0751


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.