当前位置: 首页 > news >正文

c++刷题

17.电话号码的组合

来源于题解思路: 

继承

CC14 KiKi设计类继承

#include <iostream>
#include <memory>
using namespace std;
class Shape{
private:int x;int y;
};class Rectangle:public Shape
{
public:Rectangle(int length,int width):Shape(),_length(length),_width(width){}void GetArea(){cout<<_length*_width<<endl;}
protected:int _length;int _width;
};
class Circle:public Shape{
public:Circle(int r):Shape(),_r(r){}void GetArea(){cout<<3.14*_r*_r<<endl;}
private:int _r;
};
class Square:public Rectangle
{
public:Square(int len):Rectangle(len,len){}void GetArea(){cout<<_length*_length<<endl;}};
int main() {int length=0,width=0;cin>>length>>width;Rectangle ret(length,width);ret.GetArea();int r;cin>>r;Circle cir(r);cir.GetArea();int len;cin>>len;Square le(len);le.GetArea();
}
// 64 位输出请用 printf("%lld")

 双指针算法

283.移动零

 

http://www.lryc.cn/news/440344.html

相关文章:

  • 艾丽卡的区块链英语小课堂
  • 计算机毕业设计 公寓出租系统的设计与实现 Java实战项目 附源码+文档+视频讲解
  • eclipse使用 笔记02
  • 基于C++实现(MFC)职工工作量统计系统
  • 大家好,我叫Redis~
  • 【鸿蒙】HarmonyOS NEXT星河入门到实战6-组件化开发-样式结构重用常见组件
  • 网络安全学习(五)Burpsuite
  • 多版本node管理工具nvm
  • 如何扫描试卷去除笔迹?4种方法还原整洁试卷
  • 介绍⼀下泛型擦除
  • 从底层原理上理解ClickHouse 中的 Distributed 引擎
  • 社区志愿者服务系统小程序的设计
  • echarts map地图动态下钻,自定义标注,自定义tooltip弹窗【完整demo版本】
  • Python热频随机森林分类器算法模型模拟
  • C++11新增特性:lambda表达式、function包装器、bind绑定
  • 动态主题模型DTM(Dynamic topic model)简介及python代码
  • GDPU MySQL数据库 天码行空1 数据库的创建和基本操作
  • 《告别卡顿,一键卸载!IObit Uninstaller 13 免费版让电脑重获新生》
  • Python|基于Kimi大模型,实现上传文档并进行对话(5)
  • C++设计模式——Prototype Pattern原型模式
  • Vue3 : ref 与 reactive
  • html实现好看的多种风格手风琴折叠菜单效果合集(附源码)
  • Nacos分布式配置中心
  • C# WinForm 中 DataGridView 实现单元格cell 能进编辑状态但是不能修改单元格的效果
  • GANs-生成对抗网络
  • e冒泡排序---复杂度O(X^2)
  • C语言--结构体(学习笔记)
  • Vue项目中实现用户登录后跳回原地址
  • 【Google Chrome Windows 64 version及 WebDriver 版本】
  • [ffmpeg] 音视频编码