大侠们都过来看看,这个程序错在哪里呢?
#include<iostream>#include<string>
using namespace std;
class A
{ double a,b;
public:
A(double i,double j)
{i=a;j=b;}
double S()
{return a*b;}
double L()
{return Z*(a+b);}
class B:public A
{
double h;
public:B(double i,double j,double k)
{h=k;}
double V()
{return S()*h;}
double S1()
{return L()*h+2*S();}
}
void main()
{ B b1(2,4.2,5.1)
cout<<"S="<<b1.S()<<end1;
cout<<"S1="<<b1.s1()<<end1;
}