This is the class square and the main function.
const int max_size = 9;
class Square {
public:
void read(); //the square data is read
bool is_magic(); // determin if the given square is a magic square
private:
int sum_row(int i); // returns the row sum of the ith row
int sum_col(int i); // returns the col sum of the ith row
int sum_maindiag(); // returns the main the main diagonal sum
int sum_other(); // returns the non-main diagonal sum
int size;
int grid[max_size][max_size];
};
void main()
{
cout << "Magic Square Program" << endl << endl;
cout << "Enter a square of integers:" << endl;
Square s;
s.read();
if (s.is_magic()) cout << "That square is magic!" << endl;
else cout << "That square is not magic." << endl;
}
So basically you have to write and implement the Square class. The one that you've detailed has two public methods which means that those methods can be called anywhere. Therefore in your main you're calling the s.read() method and s.is_magic() to access the class. So you declare an instance of Square and call it s and then you use s.read() to call the read() method within s which is a instance of the class square.
You have a bunch of private functions in the square class to help write it. Private functions are functions that can only be called within that class. So start by making the read method within the square class. You should use the helper functions like sum_row() and sum_col() to help write your read function. Also the private class vars like size are able to be used across functions within the class.
If you have any questions leave a comment. But if you're trying to get out of writing the code yourself no one here is going to write it for you. By the way I've used methods/functions interchangeably here, you can look up what the difference is if you want.