답안 #145843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
145843 2019-08-21T07:09:01 Z leewj1025 짝수 정렬 (tutorial3) C++14
컴파일 오류
0 ms 0 KB
#include "grader.h"
#include<algorithm>
void sort_even(int N, int *A) {
	int i;
	sort(A, A + N);
	for(i = 0; i < N; i++) {
		if(A[i] % 2 == 0) Report(A[i]);
	}
}

Compilation message

tutorial3.cpp: In function 'void sort_even(int, int*)':
tutorial3.cpp:5:2: error: 'sort' was not declared in this scope
  sort(A, A + N);
  ^~~~
tutorial3.cpp:5:2: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from tutorial3.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:4856:5: note:   'std::sort'
     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
     ^~~~