How about you read through some of the C++ tutorials. Have a go yourself, and if you have any problems come back with specific questions. We aren't here to do your homework for you.
Alright, well that force me to bring out the actual request. I wrote a program that test whether the given 3 x 3 matrix (i may hard code) is a magic square or not. I want to limit the integers to 1 to 9 only.That's the reason why i ask how to make integer between 1 to 9.
}
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=1;a<=9;a++);
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;