下面的代码return boardxy;处有异常请改正一下#include iostream#include cstdlib#include ctimeusing namespace std;const int ROW = 15;const int COL = 15;class ChessBoard private int boardROWCOL;public ChessBoard
代码中没有明确说明异常的具体情况,因此无法确定需要修改哪一行代码。如果是因为返回了未定义的值,可以将getBoard函数中的return语句修改为:
return (x >= 0 && x < ROW && y >= 0 && y < COL) ? board[x][y] : 0;
这样,当输入的x和y不合法时,就会返回0,避免了返回未定义的值。如果有其他异常,请在问题描述中提供更多的细节。
原文地址: http://www.cveoy.top/t/topic/ho7P 著作权归作者所有。请勿转载和采集!