[求助]计算问题
想要使a,b,c
d, ,e
f,g,h
四边和为15,但程序运行不出来;
#include <iostream>
using namespace std;
int a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8;
int sh=a+b+c;
int s=a+d+f;
int rs=c+e+h;
int ds=f+g+h;
int p;
int main()
{
jiance:
{if (a=9)
{
a=1;
}
else
if (b=9)
{
b=1;
}
else
if (c=9)
{
c=1;
}
else
if (d=9)
{
d=1;
}
else
if (e=9)
{
e=1;
}
else
if (f=9)
{
f=1;
}
else
if (g=9)
{
g=1;
}
else
if (h=9)
{
h=1;
}
}
if ((sh!=15)&(s!=15)&(rs!=15)&(ds!=15))
{
goto jiance;
sh=a+b+c;
s=a+d+f;
rs=c+e+h;
ds=f+g+h;
a++;b++;c++;s++;e++;f++;g++;h++;
}
cout<<a<<"\t"<<b<<"\t"<<c<<endl;
cout<<d<<"\t\t"<<e<<endl;
cout<<f<<"\t"<<g<<"\t"<<h<<endl;
return 0;
}