菜鸟的博客

纵有疾风起,人生不言弃。

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

统计

05 2023 档案

2023.5.24
摘要:1 #include <iostream> 2 #include<iomanip> 3 using namespace std; 4 class Horse 5 { 6 public: 7 Horse() 8 { 9 cout << "Horse 申请了空间..." << endl; 10 } 11 阅读全文

posted @ 2023-05-24 21:29 hhmzd233 阅读(7) 评论(0) 推荐(0) 编辑

2023.5.23
摘要:1 #include <iostream> 2 #include <iomanip> 3 using namespace std; 4 float PI = 3.14159f; 5 class Shape 6 { 7 public: 8 virtual float getArea() = 0; 9 阅读全文

posted @ 2023-05-23 21:24 hhmzd233 阅读(6) 评论(0) 推荐(0) 编辑

new的用法复习
摘要:1 #include <iostream> 2 using namespace std; 3 int* func() 4 { 5 int* p = new int(10); 6 return p; 7 } 8 void test01() 9 { 10 int* p = func(); 11 cout 阅读全文

posted @ 2023-05-23 10:40 hhmzd233 阅读(6) 评论(0) 推荐(0) 编辑

2023.5.16
摘要:1 相信同学们对复数运算符重载已经相当熟悉啦,那今天那我们来看看分数又该如何处理呢?定义一个分数类FS,有私有成员分子fz,分母fm。另有公有成员函数FS operator + (const FS &f)对运算符“+”进行重载,实现两个分数相加。题目首先给出一个整型数n,紧跟着2n行输入,输入形如3 阅读全文

posted @ 2023-05-17 21:58 hhmzd233 阅读(28) 评论(0) 推荐(0) 编辑

2023.5.14
摘要:1 #include <iostream> 2 using namespace std; 3 #include <vector> 4 void printVector(vector<int>&v) 5 { 6 for (vector<int>::iterator it = v.begin(); it 阅读全文

posted @ 2023-05-14 23:11 hhmzd233 阅读(10) 评论(0) 推荐(0) 编辑

2023.5.13
摘要:1 #include <iostream> 2 using namespace std; 3 #include <vector> 4 void printVector(vector<int>&v) 5 { 6 for (vector<int>::iterator it = v.begin(); it 阅读全文

posted @ 2023-05-14 17:07 hhmzd233 阅读(7) 评论(0) 推荐(0) 编辑

2023.5.12
摘要://例6-17 #include <iostream> using namespace std; class Point { public: Point() :x(0), y(0) { cout << "Default Constructor called." << endl; } Point(in 阅读全文

posted @ 2023-05-13 00:24 hhmzd233 阅读(13) 评论(0) 推荐(0) 编辑

2023.5.11
摘要:1 //例6-16 2 #include <iostream> 3 using namespace std; 4 class Point 5 { 6 public: 7 Point() :x(0), y(0) 8 { 9 cout << "Default Constructor called." < 阅读全文

posted @ 2023-05-11 22:49 hhmzd233 阅读(13) 评论(0) 推荐(0) 编辑

2023.5.10
摘要:1 [实验任务四]:结构体数据的二进制文件写入 2 【问题描述】 3 定义描述的教师的结构体,依次包含如下属性,工号(int型),姓名(string型),性别(char型),用户输入整数N,描述需要输入教师信息的个数,之后依次输入教师信息,并将教师信息写入工程目录下teacher.dat文件中,以二 阅读全文

posted @ 2023-05-10 19:36 hhmzd233 阅读(19) 评论(0) 推荐(0) 编辑

2023.5.9
摘要:完成“学生cpp成绩计算”之后,修改Person和Student类,各自增加两个无参构造函数。 仍以Person类为基础,建立一个派生类Teacher,增加以下成员数据: int ID;//教师工号 Student stu[100];//学生数组 int count;//学生数目,最多不超过100 阅读全文

posted @ 2023-05-09 18:42 hhmzd233 阅读(18) 评论(0) 推荐(0) 编辑

2023.5.8
摘要:1 #include <iostream> 2 using namespace std; 3 #include <fstream> 4 #include <iomanip> 5 void test() 6 { 7 int num; 8 cout << "请输入一个十进制整数:" << endl; 9 阅读全文

posted @ 2023-05-08 19:16 hhmzd233 阅读(12) 评论(0) 推荐(0) 编辑

2023.5.7 职工管理系统
摘要:1 //boss.h 2 #pragma once 3 #include <iostream> 4 using namespace std; 5 #include "worker.h" 6 class Boss :public Worker 7 { 8 public: 9 //构造函数 10 Bos 阅读全文

posted @ 2023-05-07 20:44 hhmzd233 阅读(24) 评论(0) 推荐(0) 编辑

2023.5.7
摘要:1 //11-6 2 #include <iostream> 3 #include <fstream> 4 #include <string> 5 using namespace std; 6 class Dog 7 { 8 public: 9 Dog(){} 10 Dog(int age,int 阅读全文

posted @ 2023-05-07 10:15 hhmzd233 阅读(7) 评论(0) 推荐(0) 编辑

2023.5.6
摘要:1 //11-3 2 #include <iostream> 3 #include <fstream> 4 using namespace std; 5 void test01() 6 { 7 ofstream ofs; 8 ofs.open("test1.txt",ios::out); 9 ofs 阅读全文

posted @ 2023-05-06 22:05 hhmzd233 阅读(10) 评论(0) 推荐(0) 编辑

2023.5.5
摘要:1 //new在堆区开辟数据,手动开辟,手动释放 2 #include <iostream> 3 using namespace std; 4 //1.new的基本语法 5 int* func() 6 { 7 //new返回的是指针 8 int* p = new int(10); 9 return 阅读全文

posted @ 2023-05-05 23:03 hhmzd233 阅读(11) 评论(0) 推荐(0) 编辑

2023.5.4
摘要:1 //#include <iostream> 2 //using namespace std; 3 //#include <fstream> 4 ////写文本文件 5 //void test01() 6 //{ 7 // //1.包含头文件 fstream 8 // //2.创建流对象 9 // 阅读全文

posted @ 2023-05-05 00:39 hhmzd233 阅读(22) 评论(0) 推荐(0) 编辑

2023.5.3
摘要:1 //1.2.3函数模板案例 2 //利用函数模板封装一个排序的函数,可以对不同数据类型数组进行排序。 3 //排序规则从大到小,排序算法为选择排序 4 //分别利用char数组和int数组进行测试 5 #include <iostream> 6 using namespace std; 7 te 阅读全文

posted @ 2023-05-03 17:45 hhmzd233 阅读(8) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示