Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
queueArray
//g++ 5.4.0 #include <iostream> using namespace std; class queue { int q[10]; int f,r; public: queue() { f=-1; r=f; } void insert(int x) { if(isempty()) { f=r=0; q[r]=x; } else if(isfull()) { cout<<"is full";} else { r++; q[r]=x; } } void del() { if(isempty()) { cout<<"is empty"; } else if(r==f) { r=f=-1; } else { for(int i=0;i<r;i++) { q[i]=q[i+1]; } r--; } } bool isempty() { if(f==-1) return true; return false; } bool isfull() { if(r==9) return true; return false; } void display() { for(int i=f;i<=r;i++) cout<<q[i]<<" "; } }; int main() { queue q; q.insert(1); q.insert(2); q.insert(3); q.insert(4); q.insert(5); q.insert(6); q.insert(7); q.insert(7); q.insert(7); q.insert(10); q.insert(127); q.display(); q.del(); q.del(); q.del(); q.del(); q.del(); q.del(); q.del(); q.del(); q.del(); q.del(); q.del(); q.del(); q.del(); q.del(); q.display(); }
run
|
edit
|
history
|
help
0
Hello World
Web Browser History
задача new
UB mutex lock
major element
Void main
Test 20(2020)
c++
dsu on tree (http://codeforces.com/contest/208/problem/E)
Sort an array of 0s, 1s and 2s