fork download
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. template <typename T>
  6. T getMax(T v1,T v2,T v3)
  7. {
  8.  
  9.  
  10.  
  11. if(v1>v2 && v1>v3)
  12. {
  13. return v1;
  14. }
  15. else if(v2>v3)
  16. {
  17. return v2;
  18. }
  19. else
  20. {
  21. return v3;
  22. }
  23.  
  24. }
  25. int main()
  26. {
  27. int a,b,c;
  28. float a1,b1,c1;
  29. char a2,b2,c2;
  30. string a3="Yi",b3="yile",c3="hello";
  31. cout<<"Enter 3 value: \n";
  32. cin>>a>>b>>c;
  33. cout<<"Enter 3 floats:\n";
  34. cin>>a1>>b1>>c1;
  35. cout<<"Enter 3 chars:\n";
  36. cin>>a2>>b2>>c2;
  37. cout<<"Enter 3 strings:\n";
  38. cout<<"The biggest value is: "<<getMax(a,b,c)<<endl;
  39. cout<<"The biggest floats is: "<<getMax(a1,b1,c1)<<endl;
  40. cout<<"The biggest chars is: "<<getMax(a2,b2,c2)<<endl;
  41. cout<<"The biggest chars is: "<<getMax(a3,b3,c3)<<endl;
  42. system("pause");
  43. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:42:2: error: use of undeclared identifier 'system'
        system("pause");
        ^
1 error generated.
stdout
Standard output is empty