Beispiel #1
0
int main(int argc, char *argv[]) {

	int queue[QUEUE_SIZE];
	initQue(queue);
	srand(time(NULL));

	int addAmount = QUEUE_SIZE + 1; // Add this amount of entries
	while (addAmount) {				// Automated for testing purpose
		printQueue(queue);
		int input = rand() % 100; 	// or get from user input

		0 == add(queue,input) ? printf("\n\t\t# ERROR: Queue full. Cannot add %i.\n", input) : printf("\n\t# Added %i to queue!", input);
		addAmount--;
	}
	printQueue(queue);

	int removeAmount = QUEUE_SIZE; 	// Remove this amount of entries
	while (removeAmount) {			// Automated for testing purpose
		int nextNum = getFirst(queue);
		printf("\n\t# Removing first queue element: %i", nextNum);
		printQueue(queue);
		removeAmount--;
	}

	return 0;
}
Beispiel #2
0
int main() {
    int queue[MAX];

    initQue(queue);
    print_func(queue);
    initQue(queue);
    input(queue, 3);
    input(queue, 4);
    input(queue, 5);
    print_func(queue);
    input(queue, 8);
    print_func(queue);
    pop(queue);
    print_func(queue);

    return 0;



}