switch case , queues

Hello everybody this is my first time posting and I hope you can help me with this piece of code I'm pretty much a beginner at this and this may look mickey mouse to you.
Below I'm asked to add elements to a queue via a menu using switch cases:
I don't know what variable I should put in the brackets after 'switch'

****************************************************

My header file:::

1
2
3
4
5
6
7
#include <cstdlib>
using namespace std;


void displayMenu();
bool validateOption(int voOption);
int retrieveOption();


*************************************************

My .cpp file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "aMenu.h"
#include <iostream>

void displayMenu()
{
	system("cls");
	cout << "\t\t\t\tDeli Queue" << endl;
	cout << "\t\t\t\t**********" << endl;
	cout << endl << endl;
	cout << "1. Add a customer to the queue." << endl;
	cout << "2. Remove a customer from the queue." << endl;
	cout << "3. Display the number of customers in the queue." << endl;
	cout << "4. Exit." << endl;
	cout << "Please enter an option ...... " << endl;
}

bool validateOption(int voOption)
{
	return ((voOption > 0) && (voOption < 5));
}

int retrieveOption()
{
	int aOption;
	cin >> aOption;
	while(!validateOption(aOption))
	{
		cin >> aOption;
	}
	return aOption;
}


******************************************


my Main file:::

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "aQueue.h"
#include "aMenu.h"

int main()
{
	
	aQueue myQ(6);		//a new queue called myQ with 6 elements
	//myQ.enqueue(2);		
	//myQ.enqueue(7);
	//myQ.enqueue(19);
	//myQ.enqueue(13);
	//myQ.dequeue();
	//myQ.printQueue();	//calling the printqueue function in the .cpp
	
	while (!validateOption(4));
	{
	displayMenu();
	retrieveOption();
	switch()                
	{
	case 1:
		myQ.enqueue(1);
		break;
	case 2:
		myQ.dequeue();
		break;
	case 3:
		myQ.queueSize();
	}	
	}
	
	return 0;
}


thanks in advance for any help you can give me
Last edited on
instead of this:
1
2
retrieveOption();
switch() 

Try this:
 
switch(retrieveOption())
Thanks very much was as simple as that, that seems to work, cheers
Topic archived. No new replies allowed.