Submission #2625

# Submission time Handle Problem Language Result Execution time Memory
2625 2013-07-28T06:24:28 Z kipa00 짝수 정렬 (tutorial3) C++
Compilation error
0 ms 0 KB
#include <algorithm>
#include <vector>
#include "grader.h"

void sort_even(int N, int *A) {
  vector<int> res;
  int i;
  for (i=0; i<N; ++i) {
    if (!(*(A + i) % 2)) res.push_back(*(A+i));
  }
  sort(res.begin(), res.end());
  for (i=0; i<res.size(); ++i) [
    Report(res[i]);
  }
}

Compilation message

tutorial3.cpp: In function 'void sort_even(int, int*)':
tutorial3.cpp:6:3: error: 'vector' was not declared in this scope
tutorial3.cpp:6:3: note: suggested alternative:
/usr/include/c++/4.6/bits/stl_vector.h:180:11: note:   'std::vector'
tutorial3.cpp:6:10: error: expected primary-expression before 'int'
tutorial3.cpp:6:10: error: expected ';' before 'int'
tutorial3.cpp:9:26: error: 'res' was not declared in this scope
tutorial3.cpp:11:8: error: 'res' was not declared in this scope
tutorial3.cpp:11:30: error: 'sort' was not declared in this scope
tutorial3.cpp:11:30: note: suggested alternative:
/usr/include/c++/4.6/bits/stl_algo.h:5430:5: note:   'std::sort'
tutorial3.cpp:13:11: error: expected ',' before '(' token
tutorial3.cpp:13:11: error: expected identifier before '(' token
tutorial3.cpp:13:19: error: expected ']' before ';' token
tutorial3.cpp: In lambda function:
tutorial3.cpp:13:19: error: expected '{' before ';' token
tutorial3.cpp: In function 'void sort_even(int, int*)':
tutorial3.cpp:13:5: error: field 'sort_even(int, int*)::<lambda()>::__Report' invalidly declared function type
tutorial3.cpp:13:19: warning: lambda expressions only available with -std=c++0x or -std=gnu++0x [enabled by default]
tutorial3.cpp: At global scope:
tutorial3.cpp:15:1: error: expected declaration before '}' token