会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Lyh3012648079
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
22
23
24
25
26
27
下一页
2023年4月23日
C++第四章课后习题4-8
摘要: 定义一个dog类,包含的age,weight等属性,以及对这些属性的操作方法,实现并测试这个类。 1 #include <iostream> 2 using namespace std; 3 class Dog{ 4 private: 5 int age,weight; 6 public: 7 vo
阅读全文
posted @ 2023-04-23 21:12 新晋软工小白
阅读(54)
评论(0)
推荐(0)
2023年4月22日
C++课本第四章例题
摘要: 个人银行账户管理程序 1 #include<iostream> 2 #include <cmath> 3 using namespace std; 4 class SavingsAccount{ //储蓄账户类 5 private: 6 int id; //账号 7 double balance;
阅读全文
posted @ 2023-04-22 17:52 新晋软工小白
阅读(22)
评论(0)
推荐(0)
2023年4月21日
pta程序设计辅助平台练习题
摘要: 一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下: 首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};然后将计算的和对11取模得到值Z;最后按照以下关系对应Z值与校验码M的值: Z:0 1 2
阅读全文
posted @ 2023-04-21 20:03 新晋软工小白
阅读(903)
评论(0)
推荐(0)
2023年4月20日
C++课本第四章例题
摘要: 时钟类的完整例题 #include <iostream> using namespace std; class Clock{ private : int hour,minute,second; public: void setTime(int hour=0,int minute=0,int seco
阅读全文
posted @ 2023-04-20 16:33 新晋软工小白
阅读(36)
评论(0)
推荐(0)
2023年4月19日
C++第三章课后习题3-15
摘要: 编写递归函数getPower计算x的y次方,在同一个程序中针对整形和实数型实现两个重载的函数。 #include <iostream> using namespace std; int getPower(int x,int y) { if(y<0) { return 0; } if(y==0) {
阅读全文
posted @ 2023-04-19 20:17 新晋软工小白
阅读(32)
评论(0)
推荐(0)
2023年4月18日
C++第三章课后练习题
摘要: 编写可以求两个数最大公约数和最小公倍数的函数。 1 #include <iostream> 2 #include <cmath> 3 using namespace std; 4 int fun1(int x,int y) 5 { 6 int temp; 7 if(x<y) 8 { 9 temp=x
阅读全文
posted @ 2023-04-18 20:08 新晋软工小白
阅读(136)
评论(0)
推荐(0)
2023年4月17日
C++课本第三章课后习题 3-8
摘要: 编写函数将华氏度转化为摄氏度 #include <iostream> using namespace std; double fun(double x) { return 5.0*(x-32)/9; } int main() { double a; cin>>a; cout<<fun(a)<<end
阅读全文
posted @ 2023-04-17 20:51 新晋软工小白
阅读(32)
评论(0)
推荐(0)
pta程序设计辅助平台-练习
摘要: 现在要开发一个系统,管理对多种汽车的收费工作。给出下面的一个基类框架class Vehicle{protected:string NO;public:Vehicl virtual int fee()=0;//计算应收费用};以Vehicle为基类,构建出Car、Truck和Bus三个类。Car的收费
阅读全文
posted @ 2023-04-17 19:33 新晋软工小白
阅读(2082)
评论(0)
推荐(0)
2023年4月16日
pta程序设计类实验辅助教学平台-练习题
摘要: 定义抽象基类Shape,由它派生出五个派生类:Circle(圆形)、Square(正方形)、Rectangle( 长方形)、Trapezoid (梯形)和Triangle (三角形),用虚函数分别计算各种图形的面积,并求出它们的和。要求用基类指针数组。使它的每一个元素指向一个派生类的对象。PI=3.
阅读全文
posted @ 2023-04-16 21:04 新晋软工小白
阅读(1747)
评论(0)
推荐(0)
2023年4月15日
C++课本第三章课后习题 3-7
摘要: 完成函数,参数为两个unsigned short int 型数,返回值为第一个参数除以第二个参数的结果,数据类型为short int;如果第二个参数为0,则返回值为一1。在主程序中实现输入输出。 #include <iostream> using namespace std; short int n
阅读全文
posted @ 2023-04-15 19:37 新晋软工小白
阅读(23)
评论(0)
推荐(0)
上一页
1
···
22
23
24
25
26
27
下一页
公告