该程序假设采用size一定数量的数字对,它们是二维布尔数组中的坐标。触发的每个坐标都会将值切换为TRUE。出于某种原因,我在最后一行以及最后一行的最后一个空格中都有错误。有任何想法吗?
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(){
    const int size = 10;
    int *x = new int [size];
    int *y = new int [size];
    bool table[size][size] =  {{false}};
    for(int i = 1 ; i <= size; i++){
        cin >> x[i] >> y[i];
        if(x[i] <= size && y[i] <= size){
            table[x[i]][y[i]] = true;
        } else{
            cout << "invalid input \n";
            i--;
        }
    }
    for(int a = 1; a <= size; a++){
        for(int b= 1; b <= size; b++){
            cout << table[a][b] << " ";
        }
        cout << "\n";
    }
    return 0;
}