Files
ooplab/lab8/23.cpp
Amneesh Singh 4824ab9855 labs 8: init
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-26 17:30:37 +05:30

15 lines
238 B
C++

#include <iostream>
template <typename T>
std::enable_if_t<std::is_arithmetic<T>::value, T> sq(T x) {
return x * x;
}
int main() {
float x = 4.4;
std::cout << "double: " << sq((double)5.3) << "\nlong: " << sq(4l);
return 0;
}