打疫苗
2023-11-05 10:19:29
发布于:广东
#include<iostream>
#include<queue>
using namespace std;
queue<string> q;
string op;
int main(){
while(cin>>op){
if(op=="end"){
while(q.size()){
cout<<q.front()<<" ";
q.pop();
}
}else if(op=="out"){
int x;
cin>>x;
if(q.size()==0) cout<<"empty"<<endl;
else{
for(int i=1;i<=x&&q.size();i++){
cout<<q.front()<<" ";
q.pop();
}
cout<<endl;
}
}else{
q.push(op);
}
}
return 0;
}
这里空空如也
有帮助,赞一个