Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
я ниже писал про современный методЧто это за треш, думаю не стоит приводить в пример такую ебанутую реализацию
upd:
C++:
#include <iostream>
#include <stack>
const int CONST_MAX_SIZE = 10;
int main() {
std::stack<int> stackInst;
std::stack<int> stackBuffer;
for (size_t i = 0; i < CONST_MAX_SIZE; i++) {
stackInst.push(i);
}
while (!stackInst.empty()) {
int topValue = stackInst.top();
stackInst.pop();
if (topValue % 2 == 1) {
stackBuffer.push(topValue);
}
}
while (!stackBuffer.empty()) {
stackInst.push(stackBuffer.top());
stackBuffer.pop();
}
std::cout << "current stack data: ";
while (!stackInst.empty()) {
std::cout << stackInst.top() << " ";
stackInst.pop();
}
return 0;
}
Последнее редактирование: