二进制表达式的无效操作数(“ const pos_in_grid”和“ const pos_in_grid”)

时间:2018-10-05 19:01:33

标签: c++

var info = info.info;
var sum = 0;
for (var i = 0; i < info.length; i++) {
  sum += parseInt(info[i].number);
}
console.log(sum);
// 10

我一直在为分配编写此函数,我打算实现的任务是,如果该条目尚未出现在地图中,我想添加到我的任务中。但是,我遇到了2个错误,终端显示了一堆我很难理解的文本。

我的问题是2折。第一, 1.如何纠正此问题。 2.如果命令行显示大量错误,我应该从哪里开始解决问题。

错误信息如下:

#include<iostream>
#include<string>
#include<sstream>
#include<fstream>
#include<vector>
#include<map>
#include<cstdlib>
#include<ctime>

using namespace std;
int vertices = 5;
int grid_x = 5;
int grid_y = 5;
struct pos_in_grid
{
    int x_coordinate;
    int y_coordinate;
};
map<pos_in_grid,int> grid_with_placement;

int initial_placement();
int main()
{
    srand(time(NULL));
    initial_placement();
    return 0;
}

int initial_placement()
{
    for(int i = 1;i<=vertices;)
    {
        pos_in_grid pos_of_node;
        int j = rand()%grid_x;
        pos_of_node.x_coordinate = j;
        j = rand()%grid_y;
        pos_of_node.y_coordinate = j;
        if(grid_with_placement.find(pos_of_node) == grid_with_placement.end())
        {
            grid_with_placement[pos_of_node] = i;
            i++;
        }
        else
        {
            continue;
        }   

    }
    return 0;
}

0 个答案:

没有答案