如何创建大小为N的多个命令?

时间:2016-12-02 23:26:52

标签: c++

如果我的大小为n,我想创建一个p1到pn的命令。他们都做同样的事情,但访问不同的队列。我把队列部分放下了,但我似乎无法想办法让这个接受p和一个数字。有没有其他方法可以做到这一点?

我已经尝试过for循环和while循环但效果不好,因为它一直在崩溃

for(int i = 0; i < n; i++
{
     if(command == 'p' && i)
     {
           //store something in queue[i]... i already did this part
     }
}

//what i want is but just in 1 command looping... so the last line (if(command == 'p' && n))
if(command == 'p' && 1)
if(command == 'p' && 2)
// all the way to n
if(command == 'p' && n)

0 个答案:

没有答案