labs 8: init

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2022-12-26 17:30:37 +05:30
parent 7ba9554ed5
commit 4824ab9855
6 changed files with 129 additions and 0 deletions

14
lab8/23.cpp Normal file
View File

@@ -0,0 +1,14 @@
#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;
}