• 一直跳出does not name a type是什么原因
  • 其它
    1.00元

要写一个程序解决计算游泳池栅栏和过道造价的问题,要求是要将造价的计算放到私有里面。
#include"iostream"
#include"string"
using namespace std;

const int AISLE_PRICE=20;

const int FENCE_PAICE=35;

const float PI=3.14;

class circle

{

private:
   float a;
   float b;
       a=AISLE_PRICE*PI*((r+3)^2-(r)^2);
       b=FENCE_PAICE*2*PI*r;
public:
   void get_r(float r)
   {
       cout<<"游泳池半径为"<<r<<endl;
   }
   void price()
   {
       float c;
       float d;
       c=a;
       d=b;
       cout<<"过道的造价为:"<<c<<endl;
       cout<<"栅栏的造价为:"<<d<<endl;
   }

} ;

int main()

{

int r;
cin>>r;
circle c;
c.get_r(r);
c.price();
return 0;

}

他一直跳出“a" does not name a type;"b" does not name a type

  • 西西    2020-03-02 13:49:42
  • 阅读 1041    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信