Run ID:103455
提交时间:2024-12-28 17:10:47
#include <iostream> #include <stack> #include <queue> #include <algorithm> using namespace std; struct stu{ char name; int number,age,Chinese,maths,English; }; queue <int> q; int main(){ //栈 stack //用法 /*s.push(1); s.pop(); s.top(); s.empty(); s.size(); s.clear(); */ //队列 queue //用法 /*q.push(1); q.pop(); q.front(); q.empty(); q.size(); q.clear() */ int c; int t=0; for(int i=1;i<=30;i++){ q.push(i); } while(q.size()!=15){ t = t+1; if(t==9){ q.pop(); t=0; } else{ c=q.front(); q.pop(); q.push(c); } } int a[10000]; for(int i=0;i<=14;i++){ a[i] = q.front(); q.pop(); } sort(a,a+15); for(int i=0;i<=14;i++){ cout<<a[i]<<" "; } }