我想做一个抽奖申请。我想输入用户名,直到输入“结束”,然后程序将它们分成两组。你能推荐一些例子吗?我不知道如何开始!如果可能的话,我想跨平台。如果不可能,我想要 Linux。
最佳答案
假设我正确理解了您的问题:
伪代码:
while the user is entering user names
store the user name in a list
for half the number of items in the list
remove a random item from the list
add that item to a second list
这里是关于使用 STL 容器类的教程。您可能希望使用 std::list
:http://www.yolinux.com/TUTORIALS/LinuxTutorialC++STL.html
关于C++ Draw程序,分成两组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3025151/