Submission #145819

# Submission time Handle Problem Language Result Execution time Memory
145819 2019-08-21T07:04:57 Z lkyeon328 짝수 정렬 (tutorial3) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
using namespace std;
int sort_even(int n, int *arr){
    for (int i = 0; i < n; i++){
        if (arr[i] % 2 == 0);
        else v.push_back(arr[i])
    }
    sort(v.begin(), v.end());
    for (auto i : v) Refort v[i];
}

Compilation message

tutorial3.cpp: In function 'int sort_even(int, int*)':
tutorial3.cpp:7:14: error: 'v' was not declared in this scope
         else v.push_back(arr[i])
              ^
tutorial3.cpp:9:10: error: 'v' was not declared in this scope
     sort(v.begin(), v.end());
          ^
tutorial3.cpp:9:5: error: 'sort' was not declared in this scope
     sort(v.begin(), v.end());
     ^~~~
tutorial3.cpp:9:5: note: suggested alternative: 'qsort'
     sort(v.begin(), v.end());
     ^~~~
     qsort
tutorial3.cpp:10:19: error: unable to deduce 'auto&&' from 'v'
     for (auto i : v) Refort v[i];
                   ^
tutorial3.cpp:10:22: error: 'Refort' was not declared in this scope
     for (auto i : v) Refort v[i];
                      ^~~~~~
tutorial3.cpp:10:22: note: suggested alternative: 'qsort'
     for (auto i : v) Refort v[i];
                      ^~~~~~
                      qsort
tutorial3.cpp:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^