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;
}
相关推荐
a11177637 分钟前
三色软糖坠落玻璃池 THreeJS kimi
前端·人工智能·threejs
凤山老林2 小时前
防抖与节流:解决Web前段高频事件,性能优化的”YYDS“
前端·防抖节流
KaMeidebaby2 小时前
卡梅德生物技术快报|核酸适配体文库筛选:核酸适配体文库筛选全流程技术解析:NGS与AI辅助方案的设计与实践
前端·人工智能·物联网·算法·百度
Wect2 小时前
TypeScript 完全指南
前端·javascript·typescript
hunterandroid2 小时前
Fragment 事务与状态丢失:从崩溃现场到稳定治理
前端
清风programmer2 小时前
H5与小程序通信
前端·vue.js·uni-app
不一样的少年_2 小时前
原来 AI Agent 的核心循环这么简单:手搓一个 Agent Loop
前端·后端·agent
爱勇宝3 小时前
你以为自己性格不好,其实只是被环境反复训练
前端·后端·程序员
phltxy3 小时前
LangChain_v1_Agent快速开发和更新说明
前端·javascript·langchain
Cobyte3 小时前
通过 Vite 运行手写的模板编译器
前端·javascript·vue.js