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 <queue>
- #include <stdlib.h>
- #include <time.h>
- int main() {
- std::cout << "Demo Queue - versión librería estándar" << std::endl;
- std::queue<int> queue1 = std::queue<int>();
- std::queue<char> queue2 = std::queue<char>();
- std::srand((unsigned int)time(NULL));
- int number;
- char character;
- std::cout << "Enqueuing..." << std::endl;
- for (int c = 0; c < 10; ++c) {
- queue1.push(number = std::rand() % 10000 - 5000);
- queue2.push(character = std::rand() % 25 + 65);
- std::cout << number << " " << character << " ";
- }
- std::cout << std::endl;
- std::cout << "Dequeuing..." << std::endl;
- while (queue1.size() > 0) {
- std::cout << queue1.front() << " " << queue2.front() << " ";
- queue1.pop();
- queue2.pop();
- }
- std::cout << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement