Submission #148353

# Submission time Handle Problem Language Result Execution time Memory
148353 2019-09-01T03:59:05 Z sg1774 최댓값 (tutorial2) C++11
Compilation error
0 ms 0 KB
GetMax(int n, int a[])
{
    int s=0;
    for(int i=0;i<n;i++) s=max(s,a[i]);
    printf("%d",s);
}

Compilation message

tutorial2.cpp:2:22: error: ISO C++ forbids declaration of 'GetMax' with no type [-fpermissive]
 GetMax(int n, int a[])
                      ^
tutorial2.cpp: In function 'int GetMax(int, int*)':
tutorial2.cpp:5:28: error: 'max' was not declared in this scope
     for(int i=0;i<n;i++) s=max(s,a[i]);
                            ^~~
tutorial2.cpp:6:5: error: 'printf' was not declared in this scope
     printf("%d",s);
     ^~~~~~
tutorial2.cpp:6:5: note: suggested alternative: 'int'
     printf("%d",s);
     ^~~~~~
     int
tutorial2.cpp:7:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^