at the moment this is a stack of queue, i am trying to make it into first in first out, (FIFO) , can anyone help. thank you very much

#include <iostream.h>
#include <stdlib.h>

const int STACK_SIZE = 6;
const int NIL = -1;
const int LAST_ELEMENT = STACK_SIZE - 1;

struct  stackType
{
	int tos;
	char data[STACK_SIZE];
};



void create(stackType&);
bool full(stackType);
bool empty(stackType);
void Push(char, stackType& );
void Pop(char&,stackType& );
void Top( char&, stackType);

void display(stackType);

void create(stackType& s)
{
	s.tos = NIL;
}

bool full(stackType s)
{
	if(s.tos == LAST_ELEMENT)
		return true;
	else
		return false;
}

bool empty(stackType s)
{
	if (s.tos == NIL)
		return true;
	else
		return false;
}

void Push(stackType& s, char achar)
{
	s.tos = s.tos + 1;
	s.data[s.tos] = achar;
}

void Pop(stackType& s, char& achar)

{
	achar = s.data[s.tos];
	s.tos = s.tos + 1;
}

void display(stackType s)
{
	int i;
	for (i = s.tos; i != NIL; i++)
		cout << s.data[i] << endl;
}

void Top(stackType s, char& achar)
{
	achar = s.data[s.tos];
}

void main()
{
	stackType aStack[3];

	char command, letter;
	int use_stack = 0;
	system("cls");

	for (int i = 0 ; i<3 ; i++) create(aStack[i]);

	cout << "This program uses a stack implemented as an array\n";
	cout << "Maximum number of items = " << STACK_SIZE << endl;

	do
	{
		cout << "\nMAKING USE OF STACK " << use_stack;
		cout << "\n[P]ush data, P[O]p data, [T]op show top data";
		cout << "\n[D]isplay stack, [S]witch stack or [Q]uit -> ";
		cin >> command;
		switch(command)
		{
			case 'p' :
			case 'P' :	if(!full(aStack[use_stack]))
							{
								cout << "Enter data -> ";
								cin >> letter;
								Push(aStack[use_stack],letter);
							}
							else
								cout << "The stack is full data not pushed\n";
								break;
			case 'o' :
			case 'O' :	if (!empty(aStack[use_stack]))
							{
								Pop(aStack[use_stack], letter);
								cout << letter << " has been popped\n";
							}
							else
								cout << "Stack empty cannot pop\n";
							break;
			case 't' :
			case 'T' :	if (!empty(aStack[use_stack]))
							{
								Top(aStack[use_stack], letter);
								cout << letter << " is on top of the stack\n";
								cout << "\n";
							}
							else
								cout  << "Stack empty cannot pop\n";
							break;
			case 's' :
			case 'S' :	do
							{
								cout << "Which stack do you wish to use (0-2) ";
								cin >> use_stack;
							} while (use_stack < 0 || use_stack > 2);
							break;
			case 'd' :
			case 'D' :	if (!empty(aStack[use_stack]))
								display(aStack[use_stack]);
							else
								cout << "stack empty no data to display\n";
								break;
			case 'q' :
			case 'Q' :	cout << "Program terminated\n";
							break;
			default  :	cout << "Unknown command [" <<command << "] try again!\n";
							break;
			}
	 }	while (!(command == 'q' || command == 'Q'));
}

Code tags added. -Narue

i have read your post of c and c++ . this post increase my c and c++ foundamental knowledge and i am thankful to your resoruces and organisation.

hello everyone, just to let you know, i don't need help on this thread, i've done it, took me all night. anywhere thanks, have you got any idea how i can remove this thread

yes, so i can, i will most probably post it by tommorrow, and i will also post my final piece soon. all i need to do now it switch to different queues, and that the hard bit

This article has been dead for over six months. Start a new discussion instead.