C++中如何使用vector删去指定的元素
for(inti=0;i<6;i++){for(intn;n<inventory.size();n++)randomNumber=rand()%inventory.siz...
for (int i = 0; i < 6; i++) {
for (int n; n < inventory.size(); n++)
randomNumber = rand() % inventory.size() + 1;
inventory.pop_back(inventory[randomNumber]);《==
userlist.push_back(inventory[randomNumber]);
}
for (int i = 0; i < 6; i++) {
for (int n; n < inventory.size(); n++)
randomNumber = rand() % inventory.size() + 1;
inventory.pop_back(inventory[randomNumber]);《==
computerlist.push_back(inventory[randomNumber]);
}
其中箭头位置应该怎样改才能删除指定元素QAQ求大神帮忙 展开
for (int n; n < inventory.size(); n++)
randomNumber = rand() % inventory.size() + 1;
inventory.pop_back(inventory[randomNumber]);《==
userlist.push_back(inventory[randomNumber]);
}
for (int i = 0; i < 6; i++) {
for (int n; n < inventory.size(); n++)
randomNumber = rand() % inventory.size() + 1;
inventory.pop_back(inventory[randomNumber]);《==
computerlist.push_back(inventory[randomNumber]);
}
其中箭头位置应该怎样改才能删除指定元素QAQ求大神帮忙 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询