Advertisement
LilChicha174

Untitled

Jun 2nd, 2022
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <string>
  3. #include <cstdio>
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. class Queue {
  9. public:
  10.     // конструктор
  11.     Queue() {
  12.         curr = 0;
  13.         first = 0;
  14.     }
  15.  
  16.     ~Queue() = default;
  17.  
  18.     void push(int elem) {
  19.         arr[curr++] = elem;
  20.     }
  21.  
  22.     int front() {
  23.         return arr[first];
  24.     }
  25.  
  26.     void pop() {
  27.         first++;
  28.     }
  29.  
  30.     bool empty() {
  31.         return curr == first;
  32.     }
  33.  
  34. private:
  35.     int curr, first;
  36.     int arr[100000];
  37. };
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement