I don't know whether my program is complete. But the question of this program is
1) determine whether it is a magic square
2)make sure all rows column and diagonal adds to 15
3) make sure no number repeats
4)make sure there is no zero
5)make sure all the numbers are from 1 to 9
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int a, b, c, d, e, f, g, h, i;
int matrix[3][3] = {{7,17,3},{5,9,13},{15,1,10}};
}
int a = matrix[0][0];//11
int b = matrix[0][1];//12
int c = matrix[0][2];//13
int d = matrix[1][0];//21
int e = matrix[1][1];//22
int f = matrix[1][2];//23
int g = matrix[2][0];//31
int h = matrix[2][1];//32
int i = matrix[2][2];//33
if (a, b, c, d, e, f, g, h, i >= 1 && a <= 9) {
if ((a + b + c == d + e + f)&& (d + e + f == g + h + i)&& (a + d + g == b + e + h)&& (b + e + h== c + f + i) && (a + e + i == g + e + c)&& (a!=b!=c!=d!=e!=f!=g!=h!=i))
cout <<" this is a magic square"<<endl;
else
cout <<" this is not a magic square"<<endl;
} else {
cout<<"this is not a magic square";
// bad
}
Well. When you test it; does it satisfy all of the conditions you have to meet? If so, then yes it's likely complete. If not, then no it isn't.
Please remember; this forum is here to help people with specific problems in their code. We're not a free testing forum that will test your code, or write your homework for you.