歪歪君 2016-04-14 08:13 采纳率: 0%
浏览 1167

调试没有问题,但是w的结果却总是-89053460,为什么啊

#include
using namespace std;
class shape
{protected:
int x,y;
public:
shape()
{
x=0;
y=0;
}
shape(int q,int w)
{
x=q;
y=w;
}
};
class circle: public shape
{
int r;
public:
circle()
{
r=1;
}
circle(int q1,int q,int w):shape(q,w)
{
r=q1;
}
void point()
{
cout<<"x="<<x<<endl;
cout<<"y="<<y<<endl;
cout<<"r="<<r<<endl;
}

};
class rect: public shape
{
int w,h;
public:
rect(int u,int t,int q,int w):shape(q,w)
{
w=u;h=t;
}
rect()
{
w=1;h=1;
}
void input()
{
cout<<"x="<<x<<endl;
cout<<"y="<<y<<endl;
cout<<"w="<<w<<endl;
cout<<"h="<<h<<endl;
}

};
int main()
{
shape s;
circle c1;
circle c2(2,2,2);
rect r1;
rect r2(6,7,8,9);
c1.point ();
c2.point ();
r1.input ();
r2.input ();
return 0;
}

  • 写回答

2条回答 默认 最新

  • XML火柴 2016-04-14 08:49
    关注

    图片说明
    没错啊

    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)