Sort by

recency

|

2009 Discussions

|

  • + 0 comments
    #include<bits/stdc++.h>
    using namespace std;
    int max(int a, int b, int c, int d)
    {
        int max = 0;
        int n[]={a,b,c,d};
        for(int i=0;i<=4;i++)
        {
            if (n[i]>max) max=n[i];
        }
        return max;
    }
    int main()
    {
       int a=0,b=0,c=0,d=0;
       cin>>a;
       cin>>b;
       cin>>c;
       cin>>d;
       cout<<max(a,b,c,d);
    }
    
  • + 0 comments
    #include <cmath>
    #include <cstdio>
    #include <vector>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    
    
    int max_value(int a, int b, int c, int d) {
        
        int inputs[] = {a, b, c, d};
        int max_v = inputs[0];
        int size = sizeof(inputs) / sizeof(inputs[0]);
        
        for (int i=0; i < size; i++) {
            if (inputs[i] > max_v) {
                max_v = inputs[i];
            };
        };
        
        return max_v;
    }
    int main() {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
        int a;
        int b;
        int c;
        int d;
        scanf("%d\n", &a);
        scanf("%d\n", &b);
        scanf("%d\n", &c);
        scanf("%d\n", &d);
        
        printf("%d\n", max_value(a,  b,  c, d));
        return 0;
    }
    
  • + 0 comments

    include

    using namespace std;

    int max(int a, int b) { return (a > b) ? a:b; }

    int main() { int a,b, c ,d ; cin >> a; cin >> b; cin >> c; cin >> d; int solonnhat = max(max(a,b), max(c,d)); cout << solonnhat << endl; return 0; }

  • + 0 comments
    int getMax (vector<int> nums){
        int max = INT_MIN; //#include <limits.h>
        
        for(int i : nums){
            if(i > max) max = i;
        }
        return max;
    }
    
    int main() {
        vector<int> nums;
        int a;
        
        for(int i = 0; i < 4; ++i){
            cin >> a;
            nums.push_back(a);
        }
        
        cout << getMax(nums);
        
        
        return 0;
    }
    
  • + 0 comments
    #include <cmath>
    #include <cstdio>
    #include <vector>
    #include <iostream>
    #include <algorithm>
    //using namespace std;
    
    
    int main() {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT */
        int winner {};
        for (int i = 0; i < 4; i++) {
            int current {};
            std::cin >> current;
            
            if (current > winner)
            {
              winner = current;  
            };
        }
        std::cout << winner;    
        return 0;    
    }