最后main函数里的代码怎么改


#include <iostream>
using namespace std;

class shape
{
public:
    virtual void show() = 0;
    virtual double peri() = 0;
};
class circle :public shape
{
public:
{
    const double PI 3.14;
    int r;

    double peri(int z)
    {
        int z = 2 * PI * r;
        peri=z;
        return  2 * PI * r;
    }
        void show()
    {
        cout << "圆的半径=" << r << endl;
        cout << "圆的周长=" << peri << endl;
    }
};

 int main()
{
     circle a1 (2);
    shape* pS;
    
    p = &a1;
    p->show()
}

 #include <iostream>
using namespace std;
 
class shape
{
    public:
        virtual void show() = 0;
        virtual double peri(int z) = 0;
};

class circle :public shape
{
    public:
        const double PI=3.14;
        int r;
        double c;
        circle(int z){
            c = peri(z);
        }
         double peri(int z){
             r = z;
            return 2 * PI * r;
        }
        void show(){
            cout << "圆的半径=" << r << endl;
            cout << "圆的周长=" << c << endl;
        }
};
 
int main()
{
    circle a1(2);
    shape* p;
    
    p = &a1;
    p->show();
}