QT day 2

cpp 复制代码
#include <iostream>

using namespace std;
class rect
{
private:
    int width;
    int height;
public:
    void init(int width , int height);
    void set_w(int width);
    void set_h(int height);
    void show();
};
void rect::show()
{
    cout << width << " ";
    cout << height << endl;
}
void rect::init(int width, int height)
{
    this -> width=width;
    this -> height=height;
}
void rect::set_w(int width)
{
    this -> width=width;
}
void rect :: set_h(int height)
{
    this -> height=height;
}

int main()
{
    rect rec;
    rec. init (3,4);
    rec.show();
    rec.set_w(7);
    rec.show();
    rec.set_h(10);
    rec.show();

    return 0;
}
相关推荐
0思必得03 分钟前
[Web自动化] Selenium获取元素的子元素
前端·爬虫·selenium·自动化·web自动化
用户5757303346249 分钟前
🌟 从一行 HTML 到屏幕像素:浏览器是如何“画”出网页的?
前端
NEXT0611 分钟前
React Hooks 进阶:useState与useEffect的深度理解
前端·javascript·react.js
sure28217 分钟前
React Native应用中使用sqlite数据库以及音乐应用中的实际应用
前端·react native
CHU72903518 分钟前
扭蛋机盲盒小程序前端功能设计解析:打造趣味与惊喜并存的消费体验
前端·小程序
前端布道师23 分钟前
Web响应式:列表自适应布局
前端
ZeroTaboo25 分钟前
rmx:给 Windows 换一个能用的删除
前端·后端
李剑一35 分钟前
Vue实现大屏获取当前所处城市及当地天气(纯免费)
前端
_果果然1 小时前
这 7 个免费 Lottie 动画网站,帮你省下一个设计师的工资
前端
QT.qtqtqtqtqt1 小时前
uni-app小程序前端开发笔记(更新中)
前端·笔记·小程序·uni-app