卡牌游戏(队列到初步学习)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 //运用STL,使代码更加标准化,可读性强 2 3 1 #include <cstdio> 4 2 #include <queue> 5 3 using namespace std; 6 4 queue<int> q; 7 5 int main() 8 6 { 9 7 int n; 10 8 scanf("%d",&n); 11 9 for(int i=0;i<n;i++) 12 10 q.push(i+1); 13 11 while(!q.empty()) 14 12 { 15 13 printf("%d ",q.front()); 16 14 q.pop(); 17 15 q.push(q.front()); 18 16 q.pop(); 19 17 } 20 18 printf("\n"); 21 19 return 0; 22 20 }