Could someone explain from where that value get ?
i wrote for fun calculate on template too work with double and int. i wrote somthing like that code : #include <iostream> using namespace std; template <class Cal1> Cal1 sum(Cal1 a, Cal1 b) { return a+b; } template <class Cal1> Cal1 sub(Cal1 a, Cal1 b){ return a-b; } template <class Cal1> Cal1 mul(Cal1 a, Cal1 b){ return a*b; } template <class Cal1> Cal1 divi(Cal1 a, Cal1 b){ if (a != 0 && b != 0){ return a/b; } else { cout << "Error division by 0 "; } } int main() { double x=0.0 , y=2.0; cout << sum(x,y) << endl << sub(x,y) << endl; cout << mul(x,y) << endl; cout << divi(x,y); return 0; } its working but i get some additional output and i don't know how too kick that output: 2 -2 0 Error division by 0 1.#QNAN what is that 1.#QNAN ? thx for explains