Write a program that will accept a list of integer number. The odd numbers will be stored into a queue call ODDQUEUE and the even number will be stored in different queue call EVENQUEUE.
this is under subject data structure and algorithm so the code might be almost same to c++ but it is different in it structure
1
Expert's answer
2011-10-07T08:05:43-0400
#include <iostream> #include <queue>
using namespace std;
int main() { queue<int> EVENQUEUE, ODDQUEUE;
int n; cout << "Total number of items: "; cin >> n;
int q, i; for (i=0; i<n; i++) { cout << "a[" << i << "]= "; cin >> q; if (q % 2) { EVENQUEUE.push(q); } else { ODDQUEUE.push(q); }; }; return 0; };
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment