在二维数组中插入结构



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

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

在错误列表中写下以下内容:

    IntelliSense: no operator "[]" matches these operands

从你的问题来看,不清楚你的实际问题是什么。所以我只展示了数组和结构组合用法的示例。

对于结构数组

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]);

最新更新