답안 #14487

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14487 2015-05-17T14:16:15 Z nosiar 짝수 정렬 (tutorial3) C++
컴파일 오류
0 ms 0 KB
#include <algorithm>
#include <vector>
int sort_even(int N, int *A)
{
    std::vector<int> x;
    for (int i = 0; i < N; ++i) if (A[i] % 2 == 0) x.push_back(A[i]);
    std::sort(x.begin(), x.end());
    for (int i : x) Report(i);
}

Compilation message

tutorial3.cpp: In function ‘int sort_even(int, int*)’:
tutorial3.cpp:8:18: error: range-based ‘for’ loops are not allowed in C++98 mode
     for (int i : x) Report(i);
                  ^
tutorial3.cpp:8:29: error: ‘Report’ was not declared in this scope
     for (int i : x) Report(i);
                             ^
tutorial3.cpp:9:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^