• + 3 comments
    #include <iostream>
    #include <cstdio>
    using namespace std;
    
    /*
    Add `int max_of_four(int a, int b, int c, int d)` here.
    */
    int max_of_four(int a, int b, int c, int d) {
        if(a>b && b<c && c<d)
            return a;
        else if(b>a && a<c && c<d)
            return b;
         else if(c>a && a<b && b<d)
            return c;
         else
            return d;
    
    }
    
    int main() {
        int a, b, c, d;
        scanf("%d %d %d %d", &a, &b, &c, &d);
        int ans = max_of_four(a, b, c, d);
        printf("%d", ans);
    
        return 0;
    }
    

    what's wrong in this code? it is showing that

    solution.cc: In function 'int main()':
    solution.cc:22:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d %d", &a, &b, &c, &d);
    

    [Edit by moderator]: Reformatted code segment.