I have written a code with template but it works only with Visual Studio( not in Dev c++ or any online compiler. I don't understand why.
#include <iostream>
using namespace std;
template <class Q1,class Q2,class Q3> // but when i write instead of 3 classes 1 class it will work
//everywhere, how could it be possible?
void min(Q1 a, Q2 b, Q3 c) {
if (a <= b && a <= c) {
cout << "\nMinimum number is: " << a << endl; }
if (b < a && b < c) {
cout << "\nMinimum number is: " << b << endl; }
if (c < a && c < b) {
cout << "\nMinimum number is: " << c << endl; }
}
int main()
{
double x,y,z;
cout << "Enter 3 numbers: " << endl;
cin >> x;
cin >> y;
cin >> z;
min(x, y, z);
}