Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class DynamicType>
  5. DynamicType areaOfTheCircle(DynamicType radius)
  6. {
  7. return 3.1415 * radius * radius;
  8. }
  9.  
  10. int main()
  11. {
  12. int x = 2;
  13. int result = areaOfTheCircle<int>(x);
  14. cout << "Area: " << result << endl;
  15. cout << "Result variable type: " << typeid(result).name() << endl;
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement