看一下小程序哪错了?
#include<iostream>using namespace std;
double FKAg(double K[],double Ag[]);
int main()
{ double K[5];double Ag[5];double KAg;
cout<<"Ag[0]=";
cin>>Ag[0];
cout<<"Ag[1]=";
cin>>Ag[1];
cout<<"Ag[2]=";
cin>>Ag[2];
cout<<"Ag[3]=";
cin>>Ag[3];
cout<<"Ag[4]=";
cin>>Ag[4];
cout<<"K[0]=";
cin>>K[0];
cout<<"K[1]=";
cin>>K[1];
cout<<"K[2]=";
cin>>K[2];
cout<<"K[3]=";
cin>>K[3];
cout<<"K[4]=";
cin>>K[4];
KAg=FKAg(K[5],Ag[5]);
cout<<"KAg="<<KAg<<endl;
return 0;
}
double FKAg(double K[],double Ag[])
{ double KAg=0;
for(int k=0;k<=4;k++)
KAg=KAg+K[k]*Ag[k];
return KAg;
}