当前位置: 首页> 娱乐> 影视 > 湘乡新闻头条_室内装修设计怎么学_企业网络营销成功案例_搜索引擎是什么意思

湘乡新闻头条_室内装修设计怎么学_企业网络营销成功案例_搜索引擎是什么意思

时间:2025/7/11 15:38:10来源:https://blog.csdn.net/2302_81211062/article/details/144383128 浏览次数:0次
湘乡新闻头条_室内装修设计怎么学_企业网络营销成功案例_搜索引擎是什么意思

 

 

 

#include <iostream>using namespace std;
class rec
{const int length;int width;
public:rec (int length):length(length){};void set_width(int W);int get_length();int get_width();void show();
};void rec::set_width(int W)
{width=W;
}
int rec::get_length()
{return length;
}
int rec::get_width()
{return width;
}
void rec::show()
{int l,s;l=2*(length+width);s=length*width;cout<<"周长:"<<l<<endl;cout<<"面积:"<<s<<endl;
}
int main()
{rec s(6);s.set_width(5);int a=s.get_width();int b=s.get_length();cout<<a<<endl;cout<<b<<endl;s.show();return 0;
}

 

#include <iostream>using namespace std;
class y
{int &R;
public:y(int &R):R(R){};void show();
};void y::show()
{double PI=3.14;double l,s;l=2*PI*R;s=PI*R*R;cout<<"周长:"<<l<<endl;cout<<"面积:"<<s<<endl;
}
int main()
{int r=4;y s(r);s.show();return 0;
}

 

 

#include <iostream>using namespace std;
class car
{string se;string brand;int speed;
public:car(string a,string b,int c):se(a),brand(b),speed(c){};void display();void acc(int a);
};void car::display()
{cout<<se<<endl;cout<<brand<<endl;cout<<speed<<endl;
}
void car::acc(int a)
{speed=a;
}
int main()
{string a,b;getline(cin,a);getline(cin,b);car s(a,b,50);s.display();s.acc(80);return 0;
}

关键字:湘乡新闻头条_室内装修设计怎么学_企业网络营销成功案例_搜索引擎是什么意思

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: