Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int board[3][3] =
- { 2, 9, 9,
- 6, 1, 9,
- 0, 4, 9 };
- bool moveDown (int row, int col) {
- if (row+1 > 3 || col+1 > 3) {
- return;
- }
- return board[row][col+1] < board[row+1][col];
- }
- int main() {
- int columns = 2; int rows = 2;
- int sum = board[0][0];
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
- cout << "current is: " <<board[i][j] << endl;
- if (moveDown(i, j)) {
- i++;
- } else {
- j++;
- }
- sum += board[i][j];
- cout << "next is: " <<board[i][j] << endl;
- }
- cout << "sum: " << sum << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement