主题:蔡鸟呼救~~~~~~~~~~~~~~~~~~~~~~
#include<iostream.h>
class TData1
{
public:
int get_value1(),get_value2();
protected:
int a[10],sum;
};
int TData1::get_value1()
{
int i,*p=a;
for(i=0;i<10;i++)
cin>>*(p+i);
cout<<endl;
for(p=a;p<(a+10);p++)
cout<<*p<<" ";
cout<<endl;
return 0;
}
int TData1::get_value2()
{
int i,j,t;
cout<<"imput 10 numbers:"<<endl;
for(i=0;i<10;i++)
cin>>a[i];
cout<<endl;
for(j=0;j<9;j++)
for(i=0;i<9-j;i++)
if(a[i]<a[i+1])
{t=a[i];a[i]=a[i+1];a[i+1]=t;}
cout<<"the sorted numbers:"<<endl;
for(i=0;i<10;i++)
cout<<a[i]<<" ";
cout<<endl;
return 0;
}
int main()
{
TData1 array1;
array1.get_value1();
array1.get_value2();
return 0;
}
class TData2:public TData1
{public:
double average();
protected:
double c,b[10];
};
double TData2::average()
{
int *p=a,i;
for(i=0;i<10;i++)
sum+=*(p+i);
c=sum/10;
for(i=0;i<10;i++)
{
b[i]=a[i]>c?a[i]-c:c-a[i];
int main()
{
TData2 array2;
array2.average();
array2.get_value1();
array2.get_value2();
return 0;
}
error C2601: 'main' : local function definitions are illegal
fatal error C1004: unexpected end of file found
class TData1
{
public:
int get_value1(),get_value2();
protected:
int a[10],sum;
};
int TData1::get_value1()
{
int i,*p=a;
for(i=0;i<10;i++)
cin>>*(p+i);
cout<<endl;
for(p=a;p<(a+10);p++)
cout<<*p<<" ";
cout<<endl;
return 0;
}
int TData1::get_value2()
{
int i,j,t;
cout<<"imput 10 numbers:"<<endl;
for(i=0;i<10;i++)
cin>>a[i];
cout<<endl;
for(j=0;j<9;j++)
for(i=0;i<9-j;i++)
if(a[i]<a[i+1])
{t=a[i];a[i]=a[i+1];a[i+1]=t;}
cout<<"the sorted numbers:"<<endl;
for(i=0;i<10;i++)
cout<<a[i]<<" ";
cout<<endl;
return 0;
}
int main()
{
TData1 array1;
array1.get_value1();
array1.get_value2();
return 0;
}
class TData2:public TData1
{public:
double average();
protected:
double c,b[10];
};
double TData2::average()
{
int *p=a,i;
for(i=0;i<10;i++)
sum+=*(p+i);
c=sum/10;
for(i=0;i<10;i++)
{
b[i]=a[i]>c?a[i]-c:c-a[i];
int main()
{
TData2 array2;
array2.average();
array2.get_value1();
array2.get_value2();
return 0;
}
error C2601: 'main' : local function definitions are illegal
fatal error C1004: unexpected end of file found