找不到错误啊。。。求指导
一元多项式的常数包括系数和指数,定义一个结构体,包括系数和指数成员,输入x的值,计算x5+4x4+6x3+10x2+23x+100的值,系数和指数用数组存储。struct multi_exp
{
int const;
int exp;
};
struct multi_exp s[5];
s数组中存储着{1,5},{4,4},{6,3},{10,2},{23,1},{100,0}
#include<stdio.h>
#include<math.h>
struct multi_exp
{
int const a;
int exp;
};
void main()
{
struct multi_exp s[5]={{1,5},{4,4},{6,3},{10,2},{23,1},{100,0}};
int x;
int suam(int x);
{
int sum=0;
for(int i=0;i<5;i++)
{
sum=sum+s[i].a*pow(x,s[i].esp);
}
return sum;
}
scanf("%d",&x);
printf("%d",suam(x));
}