#include "stdafx.h"
#include
using namespace std;
#include
class Point
{
int x;
int y;
public:
Point(){}
Point(int xx,int yy){x = xx;y = yy;}
~Point(){}
int X(){return x;}
int Y(){return y;}
};
class Line :public Point
{
Point Pa;
Point Pb;
public:
Line(){}
Line(Point pa,Point pb){Pa = pa;Pb = pb;};
float GetLineLengh();//获取直线长度
float GetLineAscent();//获取直线斜率
};
float Line::GetLineLengh()
{
int Lx = (abs(Pb.X()-Pa.X()))*(abs(Pb.X()-Pa.X()));
int Ly = (abs(Pb.Y()-Pa.Y()))*(abs(Pb.Y()-Pa.Y()));
return sqrt((float)(Lx+Ly));
}
float Line::GetLineAscent()
{
if(Pa.X() == Pb.X())
{
cout<<"斜率不存在"<
else return (float) (Pb.Y()-Pa.Y())/(Pb.X()-Pa.Y());
}
class Circle : public Point
{
float Radius;
public:
Circle(){}
Circle(float Rr){Radius = Rr;}
~Circle(){}
float GetCircleS(){return (float)3.14*Radius;}
float GetRadius(){return (float)Radius;}
};
class Cylinder :public Circle
{
float High;
Circle Cir;
public:
Cylinder(){}
Cylinder(Circle& cir,float high){Cir = cir;High = high;}
~Cylinder(){}
float GetCylinderS(){return (float)2*3.14*Cir.GetRadius()*High+2*3.14*Cir.GetRadius();}
float GetCylinderV(){return (float)3.14*Cir.GetRadius()*Cir.GetRadius()*High;}
};
class Spheroid : public Circle
{
float RR;
public:
Spheroid(){}
Spheroid(float rr){RR = rr;}
~Spheroid(){}
float GetSpheroidS(){return (float)4*3.14*RR*RR; }
float GetSpheroidV(){return (float)4*3.14*RR*RR*RR/3; }
};
int main()
{
Point Pa(1,2);
Point Pb(1,5);
Line ab(Pa,Pb);
cout<<"直线长度为:"<
cout<<"圆半径为"<
cout<<"圆柱的表面积为:"<
cout<<"球的表面积为:"<
}
Press any key to continue
*/
#include
void main() {
int i,j,k,a[3][3][3];
for(i = 0;i < 3;i++)
for(j = 0;j < 3;j++)
for(k = 0;k < 3;k++)
a[i][j][k] = i + j + k;
for(i = 0;i < 3;i++) {
for(j = 0;j < 3;j++) {
for(k = 0;k < 3;k++)
printf("%5d ",a[i][j][k]);
printf("\n");
}
printf("\n");
}
printf("\n");
}
问题貌似没有问完啊,就算是复制粘贴也该有个完整的啊