Submission #18914

#TimeUsernameProblemLanguageResultExecution timeMemory
18914dltldls95최댓값 (tutorial2)C++98
Compilation error
0 ms0 KiB
#include <algorithm> #include <iostream> int arr[10000]; int main() { int num; std::cin >> num; for (int i = 0; i < num; i++) { std::cin >> arr[i]; } std::cout<<GetMax(num, arr)<<std::endl; return 0; } int GetMax(int n, int *a) { return *max_element(a, a + n); }

Compilation message (stderr)

tutorial2.cpp: In function ‘int main()’:
tutorial2.cpp:12:29: error: ‘GetMax’ was not declared in this scope
   std::cout<<GetMax(num, arr)<<std::endl;
                             ^
tutorial2.cpp: In function ‘int GetMax(int, int*)’:
tutorial2.cpp:17:31: error: ‘max_element’ was not declared in this scope
   return *max_element(a, a + n);
                               ^
tutorial2.cpp:17:31: note: suggested alternative:
In file included from /usr/include/c++/4.9/algorithm:62:0,
                 from tutorial2.cpp:1:
/usr/include/c++/4.9/bits/stl_algo.h:5510:5: note:   ‘std::max_element’
     max_element(_ForwardIterator __first, _ForwardIterator __last,
     ^
tutorial2.cpp:19:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^