#include<iostream>
#include<cmath>
using namespace std;
float max(float x[1][1],float y[1][1],float z[1][1]);
int main()
{
int n,i,j,k;
float a[10][10],b[10],p[10],s[10];
printf("\nPlease Input The Value OF n:");
scanf("%d",&n);
printf("\nThe value of n:\n");
printf("\nn=%d",n) ;
printf("\nPlease Input The Value of a[i][j]:\n");
for (i=1;i<=n;i++)
for (j=1;j<=n;j++)
scanf("%f",&a[i][j]);
printf("\nThe Value of a[][]:\n");
for (i=1;i<=n;i++)
for (j=1;j<=n;j++)
printf("\na[][]=%f\n",a[i][j]) ;
printf("\nPlease input the value of b[]:\n");
for(i=1;i<=n;i++)
scanf("%f",&b[i]);
printf("\nThe Value of b[][]:\n");
for(i=1;i<=n;i++)
printf("\n%f\n",b[i]);
for(i=1;i<=n;i++)
{s[i]=max(a[i][1],a[i][2],a[i][3]);
p[i]=i;}
for(i=1;i<=n;i++)
{printf("\ns[]=",s[i]);
printf("\np[]=",p[i]);}
for(k=1;k<n;k++)
return 0;
}
float max(float x[1][1],float y[1][1],float z[1][1])
{float t,x0,y0,z0;
x0=fabs(x[1][1]);
y0=fabs(y[1][1]);
z0=fabs(z[1][1]);
if(x0>=y0)
t=x0;
else
t=y0;
if(t>=z0)
return t;
else return z0;
}
编的,调试的问题是:
error C2664: 'max' : cannot convert parameter 1 from 'float' to 'float [][1]'
There is no context in which this conversion is possible
执行 cl.exe 时出错.
No31.obj - 1 error(s), 0 warning(s)问题是出在max这个函数的调用上吗?请高手点拨一二...
[此贴子已经被作者于2007-10-15 21:03:03编辑过]