fork download
  1. #include<vector>
  2. using namespace std;
  3.  
  4. void slidingwindow_naive(vector<int> &array, vector<int> &minv, vector<int> &maxv){
  5. int pos;
  6. for(pos=0; pos < array.size(); ++pos){
  7. int minval = maxval = array[pos];
  8. int i;
  9.  
  10. for(i=1;i<K;++i){
  11. minval = min(minval, array[i]);
  12. maxval = max(maxval, array[i]);
  13. }
  14.  
  15. minv.push_back(minval);
  16. maxv.push_back(maxval);
  17. }
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void slidingwindow_naive(std::vector<int>&, std::vector<int>&, std::vector<int>&)’:
prog.cpp:6:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
prog.cpp:7:22: error: ‘maxval’ was not declared in this scope
prog.cpp:10:19: error: ‘K’ was not declared in this scope
stdout
Standard output is empty