#include<iostream>
#include<string>
using namespace std;
class Cube{
private:
int lenth;
int width;
int hight;
public:
void set_lenth(int _lenth){
lenth = _lenth;
}
int get_lenth(){
return lenth;
}
void set_width(int _width){
width = _width;
}
int get_width(){
return width;
}
void set_hight(int _hight){
hight = _hight;
}
int get_hight(){
return hight;
}
int cal_s(){
return 2*lenth*width + 2*width*hight + 2*lenth*hight;
}
int cal_v(){
return lenth*width*hight;
}
bool is_same_byclass(Cube & c){
if (lenth==c.get_lenth() &&
width==c.get_width() &&
hight==c.get_hight()){
return true;
}
return false;
}
};
bool is_same(Cube & c1, Cube & c2){
if (c1.get_lenth()==c2.get_lenth() &&
c1.get_width()==c2.get_width() &&
c1.get_hight()==c2.get_hight()){
return true;
}
return false;
}
class Point{
private:
int x;
int y;
public:
void set_x(int _x){
x = _x;
}
int get_x(){
return x;
}
void set_y(int _y){
y = _y;
}
int get_y(){
return y;
}
};
class Circle{
private:
int r;
Point center;
public:
void set_r(int _r){
r = _r;
}
int get_r(){
return r;
}
void set_center(Point _center){
center = _center;
}
Point get_center(){
return center;
}
};
void is_incircle(Circle & c, Point & p){
int p_distance =
(c.get_center().get_x() - p.get_x())*(c.get_center().get_x() - p.get_x()) +
(c.get_center().get_y() - p.get_y())*(c.get_center().get_y() - p.get_y());
int r_distance = c.get_r() * c.get_r();
if(p_distance == r_distance){
cout << "点在圆上" << endl;
}else if(p_distance > r_distance){
cout << "点在圆外" << endl;
}else{
cout << "点在圆内" << endl;
}
}
int main(){
Cube c1;
c1.set_lenth(10);
c1.set_width(10);
c1.set_hight(10);
cout << c1.cal_s() << endl;
cout << c1.cal_v() << endl;
Cube c2;
c2.set_lenth(10);
c2.set_width(10);
c2.set_hight(20);
bool result = is_same(c1, c2);
if (result){
cout << "c1c2相等" << endl;
}else{
cout << "c1c2不等" << endl;
}
result = c1.is_same_byclass(c2);
if (result){
cout << "c1c2相等" << endl;
}else{
cout << "c1c2不等" << endl;
}
Point center;
center.set_x(10);
center.set_y(0);
Circle c;
c.set_center(center);
c.set_r(10);
Point p;
p.set_x(10);
p.set_y(10);
is_incircle(c, p);
p.set_x(10);
p.set_y(11);
is_incircle(c, p);
p.set_x(10);
p.set_y(9);
is_incircle(c, p);
return 0;
}

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!