bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / eduincs / pgrm_009.cpp

pgrm_009.cpp (729B)


      1 /* WAP in cpp to overload the following functions
      2     int max(int a, int b);
      3     int max(int a, int b, int c);
      4     float max(float a, float b);
      5 */
      6 
      7 #include<iostream>
      8 using namespace std;
      9 class Maximum {
     10 public:
     11     int max(int a, int b) {
     12         return (a > b) ? a : b;
     13     }
     14     
     15     int max(int a, int b, int c) {
     16         int m = a;
     17         if(m < b) m = b;
     18         if(m < c) m = c;
     19         return m;
     20     }
     21 
     22     float max(float a, float b) {
     23         return (a > b) ? a : b;
     24     }
     25 };
     26 
     27 int main() {
     28     Maximum obj;
     29     cout << "Between 10, 20: " << obj.max(10, 20) << endl;
     30     cout << "Between 10, 20, 30: " << obj.max(10, 20, 30) << endl;
     31     cout << "Between 11.5, 10.5: " << obj.max(11.5f, 10.5f) << endl;
     32     return 0;
     33 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror