Q:

I have been created a template function but i got an error for checking if the input is an odd or even in C++

I have been created the template function to check for the minimum between three different data types which are ( int , float , and char ) I think my code is pretty much good but when it come to executing it said invalid operands of types 'float' and 'int' to binary operator % I'm not sure what to do in this case, my code is : 
#include <iostream>
#include <math.h>
using namespace std;

template <class type>

    type mini(type a , type b)
    {
        type x;
        x = fmod(a,b);
        if (x ==0)
        {
            cout<<"it is an even";
            return x;
        }
        else
            cout<<"it is an odd";
            return x;
    }

int main()
{
    cout<<"Enter an integer:";
    int a,b;
    cin>>a>>b;
    mini <int> (a,b);
    cout<<"\n";
    cout<<"Enter a character:";
    char x,y;
    cin>>x>>y;
    mini <char> (x,y);
    cout<<"\n";
    cout<<"Enter a floating pointing:";
    float c,d;
    cin>>c>>d;
    mini <float> (c,d);
    cout<<"\n";
    return 0;
}

I updated the code, is it correct ? 

A:

Go with fmod as the double don't have the operator % implemented.
Below link can help more:
error C2296: '%' : illegal, left operand has type 'double' in C++

