0

当我尝试在二维数组中添加结构时

cin>>array[1][items.stoka_ime];

在错误列表中写下:

    IntelliSense: no operator "[]" matches these operands
4

1 回答 1

-3

从您的问题中不清楚您的实际问题是什么。所以我只是展示了一个数组和结构组合使用的示例。

对于结构数组

struct abc
{
int i;
int j;
}

abc object[10];

cin>>object[0].i>>object[0].j;

结构中的数组

struct abc
    {
      int i[10];
    }         
 abc object;                  
 cin>>object.i[0];

推入队列结构数组:

queue.push(array[i]);
于 2012-06-18T10:53:43.460 回答