随笔分类 -  C++ 基础二

1 2 下一页

C++编程基础二 28-复习2
摘要:1 // C++函数和类 28-复习2.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 8 using namespace std; 9 10 //定义类,class关键字 类名 11 //类的数据成员(私有private),类的成员方法(公有publi... 阅读全文

posted @ 2018-07-22 00:04 uimodel 阅读(138) 评论(0) 推荐(0)

C++编程基础二 27-复习1
摘要:1 // C++函数和类 27-复习1.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 8 using namespace std; 9 10 //函数原型 11 int max(int num1, int num2); 12 //默认参数 13 int max(int ... 阅读全文

posted @ 2018-07-22 00:04 uimodel 阅读(140) 评论(0) 推荐(0)

C++编程基础二 26-习题5
摘要:1 #pragma once 2 #ifndef DRUG_H_ 3 #define DRUG_H_ 4 #include 5 using namespace std; 6 7 enum Type 8 { 9 PlusHP, 10 PlusMP 11 }; 12 13 class Drug 14 { 15 private: 16 string na... 阅读全文

posted @ 2018-07-22 00:03 uimodel 阅读(241) 评论(0) 推荐(0)

C++编程基础二 23-对象数组
摘要:1 #pragma once 2 #ifndef ARRAY_H_ 3 #define ARRAY_H_ 4 5 class Calculator 6 { 7 private: 8 float number1_; 9 float number2_; 10 11 public: 12 Calculator(float num1,float nu... 阅读全文

posted @ 2018-07-22 00:02 uimodel 阅读(143) 评论(0) 推荐(0)

C++编程基础二 22-this指针
摘要:1 #pragma once 2 3 #ifndef CUBOID_H_ 4 #define CUBOID_H_ 5 6 7 class Cuboid 8 { 9 private: 10 double length_; 11 double width_; 12 double height_; 13 public: 14 Cuboid(dou... 阅读全文

posted @ 2018-07-22 00:01 uimodel 阅读(182) 评论(0) 推荐(0)

C++编程基础二 20-类对象的声明和使用
摘要:1 #pragma once 2 #ifndef STUDENT_ 3 #include 4 #include 5 6 using namespace std; 7 8 #endif // !STUDENT_ 9 10 //类的声明 11 class Student 12 { 13 private: 14 //Student类的友元函数,但是不是这个类的函数... 阅读全文

posted @ 2018-07-21 23:59 uimodel 阅读(283) 评论(0) 推荐(0)

C++编程基础二 16-习题4
摘要:1 #pragma once 2 3 #ifndef DRUG_H_ 4 #define DRUG_H_ 5 #include 6 7 using namespace std; 8 9 enum Type 10 { 11 plusHP, 12 plusMP, 13 }; 14 15 16 struct Drug //药水属性 17 { 18 ... 阅读全文

posted @ 2018-07-21 23:58 uimodel 阅读(179) 评论(0) 推荐(0)

C++编程基础二 15-分离式编译
摘要:1 #pragma once 2 3 #ifndef GAME_H_ 4 #define GAME_H_ 5 6 #include 7 using namespace std; 8 9 struct Game 10 { 11 string gameName; 12 string gameScore; 13 }; 14 15 void inputGame... 阅读全文

posted @ 2018-07-21 23:56 uimodel 阅读(285) 评论(0) 推荐(0)

C++编程基础二 14-函数指针
摘要:1 // C++函数和类 14-函数指针.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 //与数据项类似,函数也有地址。函数的地址是储存其机器语... 阅读全文

posted @ 2018-07-21 23:55 uimodel 阅读(156) 评论(0) 推荐(0)

C++编程基础二 13-函数与string对象
摘要:1 // C++函数和类 13-函数与string对象.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 void fill_games(string na... 阅读全文

posted @ 2018-07-21 23:54 uimodel 阅读(234) 评论(0) 推荐(0)

C++编程基础二 12-函数与结构体
摘要:1 // C++函数和类 12-函数与结构体.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 struct WorkTime 13 { 14 ... 阅读全文

posted @ 2018-07-21 23:53 uimodel 阅读(167) 评论(0) 推荐(0)

C++编程基础二 10-函数重载
摘要:1 // C++函数和类 10-函数重载.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 //如果同一个作用域内的几个函数名字相同但... 阅读全文

posted @ 2018-07-21 23:52 uimodel 阅读(184) 评论(0) 推荐(0)

C++编程基础二 11-习题3
摘要:1 // C++函数和类 11-习题3.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 //完成程序:射击分数显示 13 //要求: 14 //1... 阅读全文

posted @ 2018-07-21 23:52 uimodel 阅读(186) 评论(0) 推荐(0)

C++编程基础二 09-constexpr函数
摘要:1 // C++函数和类 09-constexpr函数.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 //constexpr函数:是指能用于常量... 阅读全文

posted @ 2018-07-21 23:50 uimodel 阅读(203) 评论(0) 推荐(0)

C++编程基础二 08-内联函数
摘要:1 // C++函数和类 08-内联函数.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 //内联函数是C++为提高程序运行速度所做的一项改进。 ... 阅读全文

posted @ 2018-07-21 23:49 uimodel 阅读(139) 评论(0) 推荐(0)

C++编程基础二 06-递归函数
摘要:1 // C++函数和类 06-递归函数.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 11 using namespace std; 12 long fact(int i); 13 int mai... 阅读全文

posted @ 2018-07-21 23:48 uimodel 阅读(141) 评论(0) 推荐(0)

C++编程基础二 07-习题2
摘要:1 // C++函数和类 07-习题2.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 float harmonicMean(float a, float... 阅读全文

posted @ 2018-07-21 23:48 uimodel 阅读(137) 评论(0) 推荐(0)

C++编程基础二 05-返回类型
摘要:1 // C++函数和类 05-返回类型.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 void swap(int &a, int &b); ... 阅读全文

posted @ 2018-07-21 23:43 uimodel 阅读(271) 评论(0) 推荐(0)

C++编程基础二 04-默认实参
摘要:1 // C++函数和类 04-默认实参.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 //默认实参:某些函数有这样一种形参。在函数的很多次调用... 阅读全文

posted @ 2018-07-21 23:30 uimodel 阅读(134) 评论(0) 推荐(0)

C++编程基础二 03-const形参与实参
摘要:1 // C++函数和类 03-const形参与实参.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 int cube1(... 阅读全文

posted @ 2018-07-21 23:24 uimodel 阅读(254) 评论(0) 推荐(0)

1 2 下一页

导航