Submission #19190

#TimeUsernameProblemLanguageResultExecution timeMemory
19190anrhks1212최댓값 (tutorial2)C++98
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; int GetMax(int N, int *A) { int i, size=0 , max; for (i = 0; i<N; i++) { cin >> A[i]; } max = A[0]; for (i = 0; i < N - 1; i++) { if (max < A[i + 1]) { max = A[i + 1]; } } return max; } int main() { int N; cin >> N; int *A = new int[N - 1]; cout<<GetMax(N, A); return 0;

Compilation message (stderr)

tutorial2.cpp: In function ‘int GetMax(int, int*)’:
tutorial2.cpp:5:9: warning: unused variable ‘size’ [-Wunused-variable]
  int i, size=0 , max;
         ^
tutorial2.cpp: In function ‘int main()’:
tutorial2.cpp:29:13: error: expected ‘}’ at end of input
     return 0;
             ^