warning C4700: local variable 'pp' used without having been initialized
#include<iostream.h>classpoint{private:floatxcoord,ycoord;public:voidsetx(floatx){xco...
#include<iostream.h>
class point
{
private:
float xcoord,ycoord;
public:
void setx(float x){xcoord =x;}
void sety(float y){ycoord =y;}
float getx();
float gety();
};
float point::getx(){return xcoord;}
float point::gety(){return ycoord;}
void main()
{
point p1,*pp;
p1.setx(3);
p1.sety(8);
pp->setx(5);
pp->sety(7);
cout<<"x1="<<p1.getx()<<",y1";
cout<<p1.gety()<<endl;
cout<<"x2="<<(*pp).getx()<<",y2=";
cout<<(*pp).gety()<<endl;
}
运行不了 停止工作了 展开
class point
{
private:
float xcoord,ycoord;
public:
void setx(float x){xcoord =x;}
void sety(float y){ycoord =y;}
float getx();
float gety();
};
float point::getx(){return xcoord;}
float point::gety(){return ycoord;}
void main()
{
point p1,*pp;
p1.setx(3);
p1.sety(8);
pp->setx(5);
pp->sety(7);
cout<<"x1="<<p1.getx()<<",y1";
cout<<p1.gety()<<endl;
cout<<"x2="<<(*pp).getx()<<",y2=";
cout<<(*pp).gety()<<endl;
}
运行不了 停止工作了 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询