fork download
  1. #include<iostream>
  2. #include <cstdlib>
  3.  
  4. template<class T>
  5. T min(T a,T b)
  6. {
  7. return (a<b)?a:b;
  8. }
  9.  
  10.  
  11. int main(int argc, char** argv) {
  12. int d,y;
  13. std::cout<<"enter two integer values";
  14. std::cin>>d>>y;
  15. std::cout<<"you entered"<<d<<y;
  16. std::cout<<"the minimum of the two is "<<min(d,y);
  17. float p,q;
  18. std::cout<<"enter float values";
  19. std::cin>>p>>q;
  20. std::cout<<"you entered"<<p<<q;
  21. std::cout<<"the minimum of the float values is "<<min(p,q);
  22. char w,a;
  23. std::cout<<"enter the two characters";
  24. std::cin>>w>>a;
  25. std::cout<<"you entered"<<w<<a;
  26. std::cout<<"the minimum of the two characters is "<<min(w,a);
  27. return 0;
  28. }
Success #stdin #stdout 0s 3300KB
stdin
Standard input is empty
stdout
enter two integer valuesyou entered-12156475360the minimum of the two is -1215647536enter float valuesyou entered3.98852e-34-1.45733e-05the minimum of the float values is -1.45733e-05enter the two charactersyou entered��the minimum of the two characters is �