0

Can anyone see any way of improving this?

```
//____________________________________________________________________________________________
// START
#include <iostream>
using namespace std;
int maxQ, total1;
//____________________________________________________________________________________________
// CLASS(ES)
class Queue
{
int array[];
public:
//variabes
int count;
//constructors
Queue();
Queue(int q);
//functions
void add(int i);
void take();
};
//constructors initialization
Queue::Queue(int q)
{
array[maxQ];
count = 1;
total1 =0;
}
Queue::Queue()
{
array[100];
count = 1;
total1 = 0;
}
//functions initialization
void Queue::add(int i)
{
if (count == maxQ+1)
{
count=1;
cout << "\nyou have reached the end of the queue\nnow the values are being placed at the front of the queue again,\nerasing the values already there!!\n\n";
array[count] = i;
}
else if (count < maxQ+1)
{
array[count] = i;
count++;
total1++;
}
if (total1 == maxQ+1)
{
total1--;
}
}
void Queue::take()
{
if(total1 == 0)
{
cout << "\nThere are no values left in the queue!\n";
}
else
{
if (count == 1)
{
count = maxQ+1;
}
cout << "\nYou have taken " << array[count-1] << " out of the queue";
total1--;
array[count-1] = 0;
count--;
}
}
//____________________________________________________________________________________________________________________________
// MAIN
int main ()
{
int choice, values, answer, integer;
Queue value;
cout << "\nwould you like to initialize a queue of:\n-20 values(enter 1)\n-100 values (enter 2)\n-an amount of your choice (enter 3)\n";
cin >> choice;
if (choice == 1)
{
Queue value(20);
maxQ = 20;
}
else if (choice == 2)
{
Queue value();
maxQ = 100;
}
else if (choice == 3)
{
cout << "\nHow many values would you like to have in your queue?: ";
cin >> values;
Queue value(values);
maxQ = values;
}
while (choice !=1 && choice !=2 && choice !=3)
{
cout << "\n" << choice << " isnt 1,2 or 3! Please re-enter 1,2 or 3: ";
cin >> choice;
}
do{
cout << "\nWould you like to:\n-Add integers to the queue (enter 1)\n-take an integer from the queue (enter 2)\n-exit (enter 3)\n";
cin >> answer;
while (answer !=1 && answer !=2 && answer !=3)
{
cout << "\n" << answer << " isnt 1,2 or 3! Please re-enter 1,2 or 3: ";
cin >> answer;
}
if (answer == 1)
{
cout << "\nWhat integer would you like to add: ";
cin >> integer;
value.add(integer);
cout << "\n" << integer << " has been added\n";
cout << "\nThere are now " << total1 << " values in the queue.";
}
else if (answer == 2)
{
value.take();
cout << "\n\nThere are now " << total1 << " values in the queue.";
}
}while (answer !=3);
return 0;
}
//____________________________________________________________________________________________
// END
```