Advertisement
CamolaZ

ProgDataStruct.

Feb 27th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. template <class myType>
  7. myType GetMax (myType a, myType b) {
  8.  return (a>b?a:b);
  9. }
  10.  
  11. int SmallInt(int num1, int num2)
  12. {
  13.  
  14.     if(num1<num2)
  15.         {
  16.         cout << num2 <<" is bigger number that: " << num1;
  17.         return num1;
  18.     }
  19.     else
  20.         return num2;
  21. }
  22.  
  23. double minD(double num1,double num2)
  24. {
  25.     if(num1<num2)
  26.         {
  27.         cout << num2 <<" is bigger number that: " << num1;
  28.         return num1;
  29.     }
  30.     else
  31.         return num2;
  32. }
  33.  
  34. int main()
  35. {
  36.     int x, y;
  37.    
  38.     cin >> x;
  39.     cin >> y;
  40.    
  41.     cout << GetMax(1,2 )<< endl;
  42.     std::cout << GetMax(1.1,2.3)<<std::endl;
  43.    
  44.     int a = 0;
  45.     double b =10.3;
  46.     std::cout << GetMax<double>(a,b)<<endl;
  47.    
  48.     SmallInt(x,y);
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement