Advertisement
bogolyubskiyalexey

Untitled

Feb 5th, 2021
792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. template <typename type>
  2. void print(type it_begin, type it_end) {
  3.     bool start_print = false;
  4.     while(it_end != it_begin) {
  5.         --it_end;
  6.         if (*it_end < 0) {
  7.             start_print = true;
  8.             continue;
  9.         }
  10.         if (start_print) {
  11.             std::cout << *it_end << "\n";
  12.         }
  13.     }
  14. }
  15.  
  16. int main() {
  17.     std::vector<int> a = {6,1,8,-5, 4};
  18.     print(a.begin(), a.end()); // 8 1 6
  19.    
  20.    
  21. }
  22.  
  23.  
  24.  
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement