Submission #19151

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

Compilation message (stderr)

tutorial2.cpp: In function ‘int main()’:
tutorial2.cpp:20:18: error: ‘GetMax’ was not declared in this scope
  cout<<GetMax(N,A)<<endl;
                  ^