0

Can you help me with C++ project 8

#include <iostream> using namespace std; class Queue { int size; int* queue; public: Queue() { size = 0; queue = new int[100]; } void add(int data) { queue[size] = data; size++; } 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; } class Queue2 : public Queue { public : void add(int data) { queue[size] = data; size++; } } //your code goes here Queue operator+(Queue &obj) { Queue res; for(int i=0;i<this->size;i++) { res.add(this->queue[i]); } for(int i=0;i<obj.size;i++) { res.add(obj.queue[i]); } return res; } Queue2

26th Feb 2021, 10:11 AM
Med Iheb Harbaoui
Med Iheb Harbaoui - avatar
1 Resposta
+ 2
Please put this in a code playground :) https://www.sololearn.com/post/75089/?ref=app
26th Feb 2021, 10:26 AM
Matthew
Matthew - avatar