Generation

generate functionTue, 18 Apr 2023

inicio Leer N SP=0 P1=1 Leer A A MOD 2=0 si A MOD 2=0 hacer SP=SP+A si no A MOD 2=0 hacer P1 = P1*A N=N-1 N=0 si N=0 Escribir SP y P1 si no regresar a Leer A fin

#include <iostream> #include <queue> using namespace std; void showq(queue <int> gq) { queue <int> g = gq; while (!g.empty()) { cout << '\t' << g.front(); g.pop(); } cout << '\n'; } int main() { queue <int> gquiz; gquiz.push(10); gquiz.push(20); gquiz.push(30); cout << "The queue gquiz is : "; showq(gquiz); cout << "\ngquiz.size() : " << gquiz.size(); cout << "\ngquiz.front() : " << gquiz.front(); cout << "\ngquiz.back() : " << gquiz.back();

Questions about programming?Chat with your personal AI assistant