0

Windows is shutting it down with a send error message option.

#include <iostream>

using namespace std;

struct attrib{
char x;
int y;
char cont;
};

attrib brd[8][8];

int main()
{
    for ( int x =-1; x<8; x++) //accesses all columns in the array
    {
        for ( int y=-1; y<8; y++) //accesses all rows in the array
            {
            brd[x][y].x= char (65 +x); //assigns columns names A-H
            brd[x][y].y= y + 1; //assigns rows numbers 1-8
            cout<< "|" << brd[x][y].x << "|";
            };
        cout<<"/n";
    };
    return(0);
}
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by NathanOliver
1

on lines 15 and 17 you are setting your counter variable to -1. when it tries to access element -1 it throws an error. try setting the variables to 0 and see what happens.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.