报错Call of non-function in function main
程序很简单,就是计算几个值,TC2.0一直报错Callofnon-functioninfunctionmain,还有两个warning:'FR'isassignedava...
程序很简单,就是计算几个值,TC2.0一直报错Call of non-function in function main ,还有两个warning:'FR' is assigned a value which is never used in function main
和 'FI' is assigned a value which is never used in function main
不懂啊,难道是我用sin函数用错了吗??
#include<stdio.h>
#include<math.h>
#define pi 3.141592
void main()
{
double x[10]={0.1,.115194E+00,.147290E+00,.255190E+00,.437588E+00,.500000E+00,.615194E+00,.647290E+00,.755190E+00,.937588E+00};
double I[9],FR,FI;
int i;
for(i=1;i<9;i++)
{
FR=(sin(2*pi*i*x[1])-sin(2*pi*i*x[2])+sin(2*pi*i*x[3])-sin(2*pi*i*x[4])+sin(2*pi*i*x[5])-sin(2*pi*i*x[6])+sin(2*pi*i*x[7])-sin(2*pi*i*x[8])+sin(2*pi*i*x[9]))/(2*pi*i);
FI=(cos(2*pi*i*x[1])-cos(2*pi*i*x[2])+cos(2*pi*i*x[3])-cos(2*pi*i*x[4])+cos(2*pi*i*x[5])-cos(2*pi*i*x[6])+cos(2*pi*i*x[7])-cos(2*pi*i*x[8])+cos(2*pi*i*x[9]))/(2*pi*i);
I[i]=4(FR*FR+FI*FI);
printf("I(%d)=%f\n",i,I[i]);
}
} 展开
和 'FI' is assigned a value which is never used in function main
不懂啊,难道是我用sin函数用错了吗??
#include<stdio.h>
#include<math.h>
#define pi 3.141592
void main()
{
double x[10]={0.1,.115194E+00,.147290E+00,.255190E+00,.437588E+00,.500000E+00,.615194E+00,.647290E+00,.755190E+00,.937588E+00};
double I[9],FR,FI;
int i;
for(i=1;i<9;i++)
{
FR=(sin(2*pi*i*x[1])-sin(2*pi*i*x[2])+sin(2*pi*i*x[3])-sin(2*pi*i*x[4])+sin(2*pi*i*x[5])-sin(2*pi*i*x[6])+sin(2*pi*i*x[7])-sin(2*pi*i*x[8])+sin(2*pi*i*x[9]))/(2*pi*i);
FI=(cos(2*pi*i*x[1])-cos(2*pi*i*x[2])+cos(2*pi*i*x[3])-cos(2*pi*i*x[4])+cos(2*pi*i*x[5])-cos(2*pi*i*x[6])+cos(2*pi*i*x[7])-cos(2*pi*i*x[8])+cos(2*pi*i*x[9]))/(2*pi*i);
I[i]=4(FR*FR+FI*FI);
printf("I(%d)=%f\n",i,I[i]);
}
} 展开
1个回答
2011-05-16
展开全部
I[i]=4(FR*FR+FI*FI);
应改为
I[i]=4*(FR*FR+FI*FI);
注意,C语言中乘号不可省略。
应改为
I[i]=4*(FR*FR+FI*FI);
注意,C语言中乘号不可省略。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询