Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Created by Julio Tentor <jtentor@fi.unju.edu.ar>
- //
- #include <iostream>
- #include "specialqueue.h"
- #include <stdlib.h>
- #include <time.h>
- int main() {
- std::cout << "Demo Queue - versión genérica - Caso Ejemplo b)" << std::endl;
- specialqueue<int> queue1 = specialqueue<int>(10);
- std::srand((unsigned int)time(NULL));
- int number;
- std::cout << "Enqueuing..." << std::endl;
- for (int c =0 ; c < 10; ++c) {
- queue1.push(number = std::rand() % 10);
- std::cout << number << " ";
- }
- std::cout << std::endl;
- std::cout << "Joining with same queue..." << std::endl;
- specialqueue<int> queue2 = queue1.join(queue1);
- std::cout << "Dequeuing..." << std::endl;
- while (queue1.size() > 0) {
- std::cout << queue1.front() << " ";
- queue1.pop();
- }
- std::cout << std::endl;
- std::cout << "Dequeuing joined queue..." << std::endl;
- while (queue2.size() > 0) {
- std::cout << queue2.front() << " ";
- queue2.pop();
- }
- std::cout << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement