Помогите пожалуйста с++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Помогите пожалуйста с++

85 проект по кодингу управление очередью #include <iostream> using namespace std; class Queue { int size; int* queue; public: Queue() { size = 0; queue = new int[100]; } void remove() { if (size == 0) { cout << "Queue is empty"<<endl; return; } else { for (int i = 0; i < size - 1; i++) { queue[i] = queue[i + 1]; } size--; } } void print() { if (size == 0) { cout << "Queue is empty"<<endl; return; } for (int i = 0; i < size; i++) { cout<<queue[i]<<" <- "; } cout <<endl; } //ваш код }; int main() { Queue q; q.add(42); q.add(2); q.add(8); q.add(1); q.print(); q.remove(); q.add(128); q.print(); q.remove(); q.remove(); q.print(); return 0; }

24th Mar 2022, 5:34 AM
Эдуард Ахтямов
1 Answer
0
Found this in Code Playground. Next time, try to search Code Playground when you need examples and inspirations 👍 https://code.sololearn.com/cWscNtZNNj53/?ref=app And please put C++ in the post's tags ☝
24th Mar 2022, 6:03 AM
Ipang