为什么编好的C++程序,编译时没错,到了运行时总是出现Win32线程退出,返回值为0,然后就没有结果了?
这是我的程序,就是计算一些数字啦。#include"iostream"usingnamespacestd;#include"cmath"voidmain(){inti=0...
这是我的程序,就是计算一些数字啦。
#include "iostream"
using namespace std;
#include "cmath"
void main()
{int i=0,j=0;
double
thita[8]={1.5708,0.7854,0,-0.7854,-1.5708,-2.3562,-3.1416,-3.927},
x[8]={-0.5,-0.35355,0,0.35355,0.5,0.35355,0,-0.35355},
y[8]={1.25,1.60355,1.75,1.60355,1.25,0.89645,0.75,0.89645},
a[8]={-0.5,-0.5,-0.20711,0.20711,0.5,0.5,0.20711,-0.20711},
b[8]={1.04290,1.45711,1.75,1.75,1.45711,1.04290,0.75,0.75},
S=0.4142,
A,B,E,
I[8][8],ln[8],aatan[8];
for(i=0;i<=7;i++)
{for(j=0;j<=7;j++)
{if(i==j)
I[i][j]=3.1416;
else
{A=0-(x[i]-a[j])*cos(thita[j])-(y[i]-b[j])*sin(thita[j]);
B=(x[i]-a[j])*(x[i]-a[j])+(y[i]-b[j])*(y[i]-b[j]);
E=(x[i]-a[j])*sin(thita[j])-(y[i]-b[j])*cos(thita[j]);
ln[j]=log(1+(S*S+2*A*S)/B);
aatan[j]=atan((S+A)/E)-atan(A/E);
I[i][j]=0.5*sin(thita[i]-thita[j])*ln[j]-cos(thita[i]-thita[j])*aatan[j];
}
cout<<I[i][j]<<" ";
while(j=7)
cout<<endl;
}
while(i=7)
cout<<endl;
}
}
问题如题,运行时调试对话框里显示Win32线程退出,返回值为0,然后也不显示结果。(编译时是成功的)。
烦请各位大侠们帮忙解决下,万分感谢。
非常感谢解答,但是当我把WHILE语句去掉之后,为什么那个黑色的对话框只弹出一下而马上就没了呢?我还想看看结果呢? 下面显示了“程序“[1140] a.exe: 本机”已退出,返回值为 0 (0x0)。”
谢谢。 展开
#include "iostream"
using namespace std;
#include "cmath"
void main()
{int i=0,j=0;
double
thita[8]={1.5708,0.7854,0,-0.7854,-1.5708,-2.3562,-3.1416,-3.927},
x[8]={-0.5,-0.35355,0,0.35355,0.5,0.35355,0,-0.35355},
y[8]={1.25,1.60355,1.75,1.60355,1.25,0.89645,0.75,0.89645},
a[8]={-0.5,-0.5,-0.20711,0.20711,0.5,0.5,0.20711,-0.20711},
b[8]={1.04290,1.45711,1.75,1.75,1.45711,1.04290,0.75,0.75},
S=0.4142,
A,B,E,
I[8][8],ln[8],aatan[8];
for(i=0;i<=7;i++)
{for(j=0;j<=7;j++)
{if(i==j)
I[i][j]=3.1416;
else
{A=0-(x[i]-a[j])*cos(thita[j])-(y[i]-b[j])*sin(thita[j]);
B=(x[i]-a[j])*(x[i]-a[j])+(y[i]-b[j])*(y[i]-b[j]);
E=(x[i]-a[j])*sin(thita[j])-(y[i]-b[j])*cos(thita[j]);
ln[j]=log(1+(S*S+2*A*S)/B);
aatan[j]=atan((S+A)/E)-atan(A/E);
I[i][j]=0.5*sin(thita[i]-thita[j])*ln[j]-cos(thita[i]-thita[j])*aatan[j];
}
cout<<I[i][j]<<" ";
while(j=7)
cout<<endl;
}
while(i=7)
cout<<endl;
}
}
问题如题,运行时调试对话框里显示Win32线程退出,返回值为0,然后也不显示结果。(编译时是成功的)。
烦请各位大侠们帮忙解决下,万分感谢。
非常感谢解答,但是当我把WHILE语句去掉之后,为什么那个黑色的对话框只弹出一下而马上就没了呢?我还想看看结果呢? 下面显示了“程序“[1140] a.exe: 本机”已退出,返回值为 0 (0x0)。”
谢谢。 展开
3个回答
展开全部
是有死循环, 估计你是把if写成while了吧? 条件判断符号== 写成=了。我给你改了一下,你看看是不是你要的。
#include "iostream"
using namespace std;
#include "cmath"
void main()
{
int i=0,j=0;
double thita[8]={1.5708,0.7854,0,-0.7854,-1.5708,-2.3562,-3.1416,-3.927},
x[8]={-0.5,-0.35355,0,0.35355,0.5,0.35355,0,-0.35355},
y[8]={1.25,1.60355,1.75,1.60355,1.25,0.89645,0.75,0.89645},
a[8]={-0.5,-0.5,-0.20711,0.20711,0.5,0.5,0.20711,-0.20711},
b[8]={1.04290,1.45711,1.75,1.75,1.45711,1.04290,0.75,0.75},
S=0.4142,
A,B,E,
I[8][8],ln[8],aatan[8];
for(i=0;i<=7;i++)
{
for(j=0;j<=7;j++)
{
if(i==j)
I[i][j]=3.1416;
else
{
A=0-(x[i]-a[j])*cos(thita[j])-(y[i]-b[j])*sin(thita[j]);
B=(x[i]-a[j])*(x[i]-a[j])+(y[i]-b[j])*(y[i]-b[j]);
E=(x[i]-a[j])*sin(thita[j])-(y[i]-b[j])*cos(thita[j]);
ln[j]=log(1+(S*S+2*A*S)/B);
aatan[j]=atan((S+A)/E)-atan(A/E);
I[i][j]=0.5*sin(thita[i]-thita[j])*ln[j]-cos(thita[i]-thita[j])*aatan[j];
}
cout<<I[i][j]<<" ";
if(j == 7)
cout<<endl;
}
if(i == 7)
cout<<endl;
}
}
#include "iostream"
using namespace std;
#include "cmath"
void main()
{
int i=0,j=0;
double thita[8]={1.5708,0.7854,0,-0.7854,-1.5708,-2.3562,-3.1416,-3.927},
x[8]={-0.5,-0.35355,0,0.35355,0.5,0.35355,0,-0.35355},
y[8]={1.25,1.60355,1.75,1.60355,1.25,0.89645,0.75,0.89645},
a[8]={-0.5,-0.5,-0.20711,0.20711,0.5,0.5,0.20711,-0.20711},
b[8]={1.04290,1.45711,1.75,1.75,1.45711,1.04290,0.75,0.75},
S=0.4142,
A,B,E,
I[8][8],ln[8],aatan[8];
for(i=0;i<=7;i++)
{
for(j=0;j<=7;j++)
{
if(i==j)
I[i][j]=3.1416;
else
{
A=0-(x[i]-a[j])*cos(thita[j])-(y[i]-b[j])*sin(thita[j]);
B=(x[i]-a[j])*(x[i]-a[j])+(y[i]-b[j])*(y[i]-b[j]);
E=(x[i]-a[j])*sin(thita[j])-(y[i]-b[j])*cos(thita[j]);
ln[j]=log(1+(S*S+2*A*S)/B);
aatan[j]=atan((S+A)/E)-atan(A/E);
I[i][j]=0.5*sin(thita[i]-thita[j])*ln[j]-cos(thita[i]-thita[j])*aatan[j];
}
cout<<I[i][j]<<" ";
if(j == 7)
cout<<endl;
}
if(i == 7)
cout<<endl;
}
}
展开全部
#include "iostream"
using namespace std;
#include "cmath"
void main()
{int i=0,j=0;
double
thita[8]={1.5708,0.7854,0,-0.7854,-1.5708,-2.3562,-3.1416,-3.927},
x[8]={-0.5,-0.35355,0,0.35355,0.5,0.35355,0,-0.35355},
y[8]={1.25,1.60355,1.75,1.60355,1.25,0.89645,0.75,0.89645},
a[8]={-0.5,-0.5,-0.20711,0.20711,0.5,0.5,0.20711,-0.20711},
b[8]={1.04290,1.45711,1.75,1.75,1.45711,1.04290,0.75,0.75},
S=0.4142,
A,B,E,
I[8][8],ln[8],aatan[8];
for(i=0;i<=7;i++)
{for(j=0;j<=7;j++)
{if(i==j)
I[i][j]=3.1416;
else
{A=0-(x[i]-a[j])*cos(thita[j])-(y[i]-b[j])*sin(thita[j]);
B=(x[i]-a[j])*(x[i]-a[j])+(y[i]-b[j])*(y[i]-b[j]);
E=(x[i]-a[j])*sin(thita[j])-(y[i]-b[j])*cos(thita[j]);
ln[j]=log(1+(S*S+2*A*S)/B);
aatan[j]=atan((S+A)/E)-atan(A/E);
I[i][j]=0.5*sin(thita[i]-thita[j])*ln[j]-cos(thita[i]-thita[j])*aatan[j];
}
cout<<I[i][j]<<" ";
while(j=7) //////////////////////这是死循环
cout<<endl;
}
while(i=7)/////////////////////////这是死循环
cout<<endl;
}
}
using namespace std;
#include "cmath"
void main()
{int i=0,j=0;
double
thita[8]={1.5708,0.7854,0,-0.7854,-1.5708,-2.3562,-3.1416,-3.927},
x[8]={-0.5,-0.35355,0,0.35355,0.5,0.35355,0,-0.35355},
y[8]={1.25,1.60355,1.75,1.60355,1.25,0.89645,0.75,0.89645},
a[8]={-0.5,-0.5,-0.20711,0.20711,0.5,0.5,0.20711,-0.20711},
b[8]={1.04290,1.45711,1.75,1.75,1.45711,1.04290,0.75,0.75},
S=0.4142,
A,B,E,
I[8][8],ln[8],aatan[8];
for(i=0;i<=7;i++)
{for(j=0;j<=7;j++)
{if(i==j)
I[i][j]=3.1416;
else
{A=0-(x[i]-a[j])*cos(thita[j])-(y[i]-b[j])*sin(thita[j]);
B=(x[i]-a[j])*(x[i]-a[j])+(y[i]-b[j])*(y[i]-b[j]);
E=(x[i]-a[j])*sin(thita[j])-(y[i]-b[j])*cos(thita[j]);
ln[j]=log(1+(S*S+2*A*S)/B);
aatan[j]=atan((S+A)/E)-atan(A/E);
I[i][j]=0.5*sin(thita[i]-thita[j])*ln[j]-cos(thita[i]-thita[j])*aatan[j];
}
cout<<I[i][j]<<" ";
while(j=7) //////////////////////这是死循环
cout<<endl;
}
while(i=7)/////////////////////////这是死循环
cout<<endl;
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
想看结果最后加一句
system("pause");
system("pause");
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询