本文整理汇总了C++中point::getColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ point::getColumn方法的具体用法?C++ point::getColumn怎么用?C++ point::getColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类point
的用法示例。
在下文中一共展示了point::getColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkNeighbors
bool checkNeighbors(point currentPoint, grid * theGrid) {
int row = currentPoint.getRow();
int column = currentPoint.getColumn();
int currentValue = theGrid->getValue(row,column);
int status;
if (row != 0) { // Neighbor to the north (Canada)
status = checkPosition(row-1, column, currentValue, theGrid);
if (status == 99) return true;
else if (status == 1) pointQueue.enqueue(point(row-1,column));
}
if (row < theGrid->getSize() -1) { // Neighbor to the south (Mexico)
status = checkPosition(row+1, column, currentValue, theGrid);
if (status == 99) return true;
else if (status == 1) pointQueue.enqueue(point(row+1,column));
}
if (column != 0) { // Neighbor to the west (Pacific)
status = checkPosition(row, column-1, currentValue, theGrid);
if (status == 99) return true;
else if (status == 1) pointQueue.enqueue(point(row,column-1));
}
if (column < theGrid->getSize() -1) { // Neighbor to the east (Atlantic)
status = checkPosition(row, column+1, currentValue, theGrid);
if (status == 99) return true;
else if (status == 1) pointQueue.enqueue(point(row,column+1));
}
return false;
}
示例2: checkNeighborsBackward
point checkNeighborsBackward(point currentPoint, grid * theGrid) {
int row = currentPoint.getRow();
int column = currentPoint.getColumn();
int currentValue = theGrid->getValue(row,column);
point nextPoint(row,column);
if (row != 0) { // Neighbor to the north (Canada)
if (theGrid->getValue(row-1,column) == currentValue-1) {
nextPoint = point(row-1,column);
pointStack.push(&nextPoint);
return nextPoint;
}
}
if (row < theGrid->getSize() -1) { // Neighbor to the south (Mexico)
if (theGrid->getValue(row+1,column) == currentValue-1) {
nextPoint = point(row+1,column);
pointStack.push(&nextPoint);
return nextPoint;
}
}
if (column != 0) { // Neighbor to the west (Pacific)
if (theGrid->getValue(row,column-1) == currentValue-1) {
nextPoint = point(row,column-1);
pointStack.push(&nextPoint);
return nextPoint;
}
}
if (column < theGrid->getSize() -1) { // Neighbor to the east (Atlantic)
if (theGrid->getValue(row,column+1) == currentValue-1) {
nextPoint = point(row,column+1);
pointStack.push(&nextPoint);
return nextPoint;
}
}
return NULL;
}
示例3:
bool point::operator !=(point & other) {
if ((other.getRow() == row) && (other.getColumn() == column)) return false;
else return true;
}