#include "iostream.h"
#include "iomanip.h"
int n;
int main(int argc, char* argv[])
{
void stu_average(int (*p)[6]);
void subject_average(int (*p)[6]);
int a[50][6];
int i,j;
int (*p)[6]=a;
cin>>n;
for (i=0;i<n;i++)
for (j=0;j<6;j++)
cin>>*(*(p+i)+j);
stu_average(a);
subject_average(a);
return 0;
}
void stu_average(int (*p)[6])
{
int sum=0;
int i,j;
for (i=0;i<n;i++)
{
cout<<*(*(p+i)+0)<<" ";
for (sum=0,j=1;j<6;j++)
{
sum+=*(*(p+i)+j);
cout<<setiosflags(ios::fixed)<<setprecision(1);
cout<<*(*(p+i)+j)<<" ";
}
cout<<sum/5.0<<endl;
}
}
void subject_average(int (*p)[6])
{
int i,j;
int sum=0;
for (j=1;j<6;j++)
{
for (i=0,sum=0;i<n;i++)
{
sum+=*(*(p+i)+j);
}
cout<<setiosflags(ios::fixed)<<setprecision(1);
cout<<(float)sum/n<<" ";
}
cout<<endl;
}
谁能给我讲一下里面的指针哦?????