会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
YUZE2001
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
下一页
2023年3月16日
6-21
摘要: 编写一个函数,统计一条英文句子中字母的个数,在主程序中实现输入输出。 1 #include <iostream> 2 #include <string> 3 #include<string.h> 4 #include <stdio.h> 5 using namespace std; 6 7 int
阅读全文
posted @ 2023-03-16 10:48 nlkdfgnvfdkl
阅读(42)
评论(0)
推荐(0)
2023年3月15日
6-20
摘要: 实现一个名为SimpleCircle 的简单圆类。其数据成员int * itsRadius为一-个指向其半径值的指针,存放其半径值。设计对数据成员的各种操作,给出这个类的完整实现并测试这个类。 1 #include <iostream> 2 #include <string> 3 #include
阅读全文
posted @ 2023-03-15 23:37 nlkdfgnvfdkl
阅读(72)
评论(0)
推荐(0)
2023年3月14日
5-14
摘要: 定义 Boat与Car 两个类,二者都有weight属性,定义二者的一个友元函数getTotal Weight(),计算二者的重量和。 1 #include <iostream> 2 #include <string> 3 #include <stdio.h> 4 using namespace s
阅读全文
posted @ 2023-03-14 22:25 nlkdfgnvfdkl
阅读(55)
评论(0)
推荐(0)
5-7
摘要: 定义一个Cat类,拥有静态数据成员numOfCats,记录Cat 的个体数目; 静态成员函数getNumOfCats(),读取numOfCats。 设计程序测试这个类,体会静态数据成员和静态成员函数的用法。 1 #include <iostream> 2 #include <string> 3 #i
阅读全文
posted @ 2023-03-14 20:38 nlkdfgnvfdkl
阅读(105)
评论(0)
推荐(0)
2023年3月13日
4-20
摘要: 定义一个负数类Complex,使得下面的代码能够工作。 complex c1(3,5);//用复数3+5i初始化c1 complex c2=4.5;//用实数4.5初始化c2 c1.add (c2) ;//将c1 与c2相加,结果保存在c1中 c1.show ( ) ;//将c1输出(这时的结果应该
阅读全文
posted @ 2023-03-13 22:19 nlkdfgnvfdkl
阅读(69)
评论(0)
推荐(0)
4-19
摘要: 编写一个名为CPU的类,描述一个CPU 的以下信息:时钟频率,最大不会超过3000MHz;字长,可以是32位或64位;核数,可以是单核,双核或四核;是否支持超线程。各项信息要求使用位域来表示。通过输出sizeof(CPU)来观察该类所占的字节数。 1 #include <iostream> 2 #i
阅读全文
posted @ 2023-03-13 20:54 nlkdfgnvfdkl
阅读(58)
评论(2)
推荐(0)
4-9
摘要: 设计并测试一个名为Rectangle 的矩形类,其属性为矩形的左下角与右上角两个点的坐标,根据坐标能计算矩形的面积。 1 #include <iostream> 2 #include <string> 3 #include <stdio.h> 4 using namespace std; 5 6 c
阅读全文
posted @ 2023-03-13 20:02 nlkdfgnvfdkl
阅读(43)
评论(0)
推荐(0)
2023年3月12日
4-8
摘要: 定义一个Dog 类,包含了age, weight等属性,以及对这些属性操作的方法。实现并测试这个类。 1 #include <iostream> 2 #include <stdio.h> 3 using namespace std; 4 5 class Dog{ 6 private: 7 int a
阅读全文
posted @ 2023-03-12 17:19 nlkdfgnvfdkl
阅读(92)
评论(0)
推荐(0)
3-15
摘要: 编写递归函数getPower计算αy,在同一个程序中针对整型和实型实现两个重载的函数:int getPower (int x, int y) ;//整型形式,当y<0时,返回0double getPower (double x, int y) ;//实型形式在主程序中实现输入输出,分别输人一个整数α
阅读全文
posted @ 2023-03-12 17:03 nlkdfgnvfdkl
阅读(53)
评论(0)
推荐(0)
3-13
摘要: 用递归的方法编写函数求Fibonacci级数,公式为Fn= Fn-1+Fn-2(n >2),F1= F2= 1 1 #include <iostream> 2 using namespace std; 3 4 int fun(int n){ 5 if(n == 1 || n == 2) return
阅读全文
posted @ 2023-03-12 16:45 nlkdfgnvfdkl
阅读(34)
评论(0)
推荐(0)
上一页
1
2
3
下一页
公告