Submission #19191

#TimeUsernameProblemLanguageResultExecution timeMemory
19191anrhks1212최댓값 (tutorial2)C++98
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; int GetMax(); int main() { int N; cin >> N; int *A = new int[N - 1]; cout<<GetMax(N, A); return 0; } 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; }

Compilation message (stderr)

tutorial2.cpp: In function ‘int main()’:
tutorial2.cpp:9:19: error: too many arguments to function ‘int GetMax()’
  cout<<GetMax(N, A);
                   ^
tutorial2.cpp:3:5: note: declared here
 int GetMax();
     ^
tutorial2.cpp: In function ‘int GetMax(int, int*)’:
tutorial2.cpp:15:9: warning: unused variable ‘size’ [-Wunused-variable]
  int i, size = 0, max;
         ^