Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- template <typename T>
- T Abs(T num) {
- return num < 0 ? -num : num;
- }
- int main() {
- setlocale(LC_ALL, "ru");
- cout << Abs(-1) << endl;
- cout << Abs(5.35) << endl;
- cout << Abs(-4.2) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement