发布网友 发布时间:2024-10-23 23:27
共2个回答
热心网友 时间:2024-10-31 15:33
代码如下:
class Recangle{
private:
int width;
int length;
public:
Recangle()
{width = 0; length = 0;};
Recangle(int w,int h)
{width = w; height = h;};
int circumference()
{return 2*(width+height)};
int Area()
{return width * height};
void changeRec(int w, int h)
{width = w; height = h;};
};
C++编程如下
#include <iostream.h>
#include <std.h>
#include <math.h>
int main()
{
int a1=5,a2=6;
int b1=4,b2=5;
int s1,s2;
s1=a1*a2;
s2=b1*b2;
printf("矩形1的面积为:%d;",s1);
printf("矩形2的面积为:%d;",s2);
if(s1>s2)
{
printf("s1>s2");
}
else
{
if(s1<s2)
{
printf("s1<s2");
}
else
{
printf("s1=s2");
}
}
热心网友 时间:2024-10-31 15:32
class Recangle{热心网友 时间:2024-10-31 15:29
代码如下:
class Recangle{
private:
int width;
int length;
public:
Recangle()
{width = 0; length = 0;};
Recangle(int w,int h)
{width = w; height = h;};
int circumference()
{return 2*(width+height)};
int Area()
{return width * height};
void changeRec(int w, int h)
{width = w; height = h;};
};
C++编程如下
#include <iostream.h>
#include <std.h>
#include <math.h>
int main()
{
int a1=5,a2=6;
int b1=4,b2=5;
int s1,s2;
s1=a1*a2;
s2=b1*b2;
printf("矩形1的面积为:%d;",s1);
printf("矩形2的面积为:%d;",s2);
if(s1>s2)
{
printf("s1>s2");
}
else
{
if(s1<s2)
{
printf("s1<s2");
}
else
{
printf("s1=s2");
}
}
热心网友 时间:2024-10-31 15:30
class Recangle{