添加了小人出列的列表
This commit is contained in:
parent
4836734b78
commit
04fc6c3604
@ -1,5 +1,6 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <limits.h>
|
||||
|
||||
struct node {
|
||||
@ -64,6 +65,8 @@ int main () {
|
||||
std::cout << "招募了小人 #" << 1 << " , 它前面是 #" << (*(*curr).prev).id << " , 它后面是 #" << (*(*curr).next).id << std::endl;
|
||||
}
|
||||
|
||||
std::stringstream out_roll;
|
||||
|
||||
int counting = 0;
|
||||
node* next_one = (*first).prev;
|
||||
while (count > 1) {
|
||||
@ -72,6 +75,7 @@ int main () {
|
||||
counting++;
|
||||
std::cout << "小人 #" << (*current).id << " 数到了" << counting;
|
||||
if (counting == 3) {
|
||||
out_roll << "#" << (*current).id << " ";
|
||||
remove_one(current);
|
||||
counting = 0;
|
||||
count--;
|
||||
@ -84,6 +88,7 @@ int main () {
|
||||
|
||||
std::cout << "=====" << std::endl
|
||||
<< "最终剩下了小人 #" << (*next_one).id << " !" << std::endl;
|
||||
std::cout << "小人的出列顺序是: " << out_roll.str() << "." << std::endl;
|
||||
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user