#include
#include
using namespace std;
class Pixcel
{
protected:
double x;//成员变量只能由构造函数初始化
double y;
public:
void set(double ix,double iy){x=ix;y=iy;}
void rset()
{x+=8,y+=9;}
double xoffset(){return x;}
double yoffset(){return y;}
double angle(){return (180/3.14159)*atan2(y,x);}
double radius(){return sqrt(x*x+y*y);}
};
void main()
{
Pixcel p;
double x,y;
cout<<"Enter x and y: "<
p.set(x,y);
p.rset();//x,y是保护成员,只有成员函数能访问,所以这里要改
cout<<"angle="<
代码修改好了,已经在VC6下编译通过:
#include
using namespace std;
#include
class Pixcel
{
public:
double x;
double y;
public:
void set(double ix,double iy){x=ix;y=iy;}
double xoffset(){return x;}
double yoffset(){return y;}
double angle(){return (180/3.14159)*atan2(y,x);}
double radius(){return sqrt(x*x+y*y);}
};
void main()
{
Pixcel p;
p.x = 0;
p.y = 0;
double x,y;
cout<<"Enter x and y: "<
p.set(x,y);
p.x+=8;
p.y+=9;
cout<<"angle="<
enjoy!
entry point for the console application.
//
#include "stdafx.h"
#include
class Rectangle
{
int len,wid;
public:
Rectangle();//分号
Rectangle(int newlen,int newwid);
int Zhouchang();
int Mianji();
void Display();
};
Rectangle::Rectangle()
{
len=0;
wid=0;//不是o
}
Rectangle::Rectangle(int newlen,int newwid)
{
len=newlen;
wid=newwid;
}
int Rectangle::Zhouchang()//*************
{
int c;
c=2*(len+wid);
return c;
}
int Rectangle::Mianji()
{
int s;
s=len*wid;
return s;
}
void Rectangle::Display()
{
int s;
int c;
s=Mianji();
c=Zhouchang();
cout<<"length: "< cout<<"矩形的周长为:"<
void main()
{
Rectangle a(5,8);
Rectangle b(9,4);
a.Display();
b.Display();
}
改的你的程序 不明白嗨我
另外,团IDC网上有许多产品团购,便宜有口碑