DSA QUEUE CODE

pull/1074/head
AntaraRoy123456 2022-10-27 17:25:59 +05:30 committed by GitHub
parent ec8bdb7c84
commit 80359f466f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 0 deletions

31
DSA QUEUE CODE 100644
View File

@ -0,0 +1,31 @@
#include <iostream>
#include <queue>
using namespace std;
int main() {
// create a queue of string
queue<string> animals;
// push elements into the queue
animals.push("Cat");
animals.push("Dog");
cout << "Queue: ";
// print elements of queue
// loop until queue is empty
while(!animals.empty()) {
// print the element
cout << animals.front() << ", ";
// pop element from the queue
animals.pop();
}
cout << endl;
return 0;
}