Question
Hello, I cannot figure out this recursion lab and I need some help. I've attached a picture of the instructions and copy/pasted the starter code.
Hello, I cannot figure out this recursion lab and I need some help. I've attached a picture of the instructions and copy/pasted the starter code.
STARTER CODE:
#include
using namespace std;
//Represents an occupied square in the grid //Do not modify the GridSquare class or its member functions class GridSquare { private: int row, col; public: GridSquare() : row(0), col(0) {} //Default constructor, (0,0) square GridSquare(int r, int c) : row(r), col(c) {} //(r,c) square //Compare with == operator, used in test cases bool operator== (const GridSquare r) const { if ((row == r.row) && (col == r.col)) { return true; } return false; } int getRow() { return row; } //return row value int getCol() { return col; } //return column value //Output using
//Function definition for /* Groups squares in 10x10 grid upon construction Additional private helper functions may be added Need to implement the constructor that takes a file name as well as findGroup The findGroup function's parameter list may be changed based on how the function is implemented */ class Grouping { private: int grid[10][10]; vector //Implement the (parameterized) constructor and findGroup functions below //Simple main function to test Grouping int main() { Grouping input1("input1.txt"); input1.printGroups(); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started