- 3

Help me in C++

#include <iostream> using namespace std ; template <typename T > T add ( T a , T b ) { return a + b ; } int main () { int i = 1; double z = 1; float x =1; cout << add ( i , i ) << " \n " ; cout << add ( z,z) << " \n " ; cout << add ( x , x ) << " \n " ; return 0 ; } this code is it correct ?

21st Jan 2022, 8:42 AM
Dee
Dee - avatar
1 Answer
+ 4
Yes this is correct 💯
22nd Jan 2022, 6:59 AM
Ankita Kumari
Ankita Kumari - avatar