1wa zadacha: #include #include using namespace std; void showstack(stack s) { while (!s.empty()) { cout << '\t' << s.top(); s.pop(); } cout << '\n'; } int main() { double a; stack s; do { cout << "Enter number: "; cin >> a; s.push(a); } while (a!=-273.15); showstack(s); return 0; } 2 zadqcha: #include #include #include #include #include using namespace std; void showq(queue gq) { queue g = gq; while (!g.empty()) { cout << '\t' << g.front(); g.pop(); } cout << '\n'; } void showlist(list g) { list :: iterator it; for(it = g.begin(); it != g.end(); ++it) cout << '\t' << *it; cout << '\n'; } //c podtochka void showstack(stack s) { while (!s.empty()) { cout << '\t' << s.top(); s.pop(); } cout << '\n'; } //a podtochka bool ordered (queue q) { queue g = q; int a=g.front(); g.pop(); while (!g.empty()) { if (a>g.front()) { return 0; } a=g.front(); g.pop(); } return 1; } //b podtochka void saveS(stack& s, queue q1, queue q2) { int iMax; if (q1.size() >= q2.size()) { iMax=q2.size(); } else { iMax=q1.size(); } for (int i=0; iq2.size()) { for (int i=0; i l; queue q1, q2; //Nachalo na zadachata do { cout << "Enter number: "; cin >> a; l.push_back(a); } while (a>=0); cout << "List: "; showlist(l); //chetni i nechetni v opashki list :: iterator it; for(it = l.begin(); it != l.end(); ++it) { if (*it%2==0) { q1.push(*it); } else { q2.push (*it); } } cout << "q1 :"; showq(q1); cout << "q2 :"; showq(q2); //a podtochka cout << "ordered (q1): " << ordered(q1) << endl; cout << "ordered (q2): " << ordered(q2) << endl; //b podtochka stack s; saveS(s, q1, q2); cout << "Stack: "; showstack(s); return 0; }