2018年7月21日

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 阅读(281) 评论(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 阅读(176) 评论(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 阅读(283) 评论(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 阅读(153) 评论(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 阅读(229) 评论(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 阅读(163) 评论(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 阅读(180) 评论(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 阅读(179) 评论(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 阅读(194) 评论(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 阅读(134) 评论(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 阅读(136) 评论(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 阅读(136) 评论(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 阅读(264) 评论(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 阅读(132) 评论(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 阅读(250) 评论(0) 推荐(0)

C++编程基础二 02-传参数

摘要: 1 // C++函数和类 02-传参数.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 //传值参数有两种方式: 13 //1.将实参的实际值复制... 阅读全文

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

C++编程基础二 01-函数

摘要: 1 // C++函数和类 01-函数.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 void greet(); //如果将函数放在main(... 阅读全文

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

C++编程基础一 35-总练习

摘要: 1 // C++编程基础 总练习.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 struct MyGame 13 { 14 string... 阅读全文

posted @ 2018-07-21 20:16 uimodel 阅读(153) 评论(0) 推荐(0)

C++编程基础一 34-总复习

摘要: 1 // 01-C++基础复习一.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 //枚举 13 enum Gender... 阅读全文

posted @ 2018-07-21 20:15 uimodel 阅读(220) 评论(0) 推荐(0)

C++编程基础一 33-编程练习题二

摘要: 1 // 33-编程练习题二.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 enum CH 13 { 14 ... 阅读全文

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

C++编程基础一 31-switch语句

摘要: 1 // 31-switch语句.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 enum HeroType // 13 { 14 T... 阅读全文

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

C++编程基础一 32-break和continue语句

摘要: 1 // 32-break和continue语句.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 int main() 13 { 14 f... 阅读全文

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

C++编程基础一 29-if语句

摘要: 1 // 29-if语句.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 int main() 13 { 14 int hp = 0; 1... 阅读全文

posted @ 2018-07-21 14:22 uimodel 阅读(222) 评论(0) 推荐(0)

C++编程基础一 30-逻辑表达式(逻辑运算符)

摘要: 1 // 30-逻辑表达式(逻辑运算符).cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 int main() 13 { 14 // ||... 阅读全文

posted @ 2018-07-21 14:22 uimodel 阅读(471) 评论(0) 推荐(0)

C++编程基础一 27-二维数组

摘要: 1 // 27-二维数组.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 11 int main() 12 { 13 int scores[5] = { 34,6,34,... 阅读全文

posted @ 2018-07-21 14:21 uimodel 阅读(168) 评论(0) 推荐(0)

C++编程基础一 28-编程练习一

摘要: 1 // 28-编程练习一.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 #include 10 11 using namespace std; 12 13 int main() 14 { ... 阅读全文

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

C++编程基础一 26-do while循环

摘要: 1 // 26-do while循环.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 11 int main() 12 { 13 //do { 14 // ... 阅读全文

posted @ 2018-07-21 14:20 uimodel 阅读(217) 评论(0) 推荐(0)

C++编程基础一 23-while循环

摘要: 1 // 23-while循环.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 11 int main() 12 { 13 //while (判断) 14 //{ ... 阅读全文

posted @ 2018-07-21 14:19 uimodel 阅读(295) 评论(0) 推荐(0)

C++编程基础一 24-类型别名

摘要: 1 // 24-类型别名.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 11 //类型别名类似小名,张三、李四、王五等。在Unreal引擎中经常遇到类型的别名。使用起来完全一样... 阅读全文

posted @ 2018-07-21 14:19 uimodel 阅读(159) 评论(0) 推荐(0)

C++编程基础一 22-组合赋值运算符和关系运算符

摘要: 1 // 22-组合赋值运算符和关系运算符.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 11 int main() 12 { 13 // + - * / 14 ... 阅读全文

posted @ 2018-07-21 14:18 uimodel 阅读(496) 评论(0) 推荐(0)

C++编程基础一 18-数组的第三种实现方式

摘要: 1 // 18-数组的第三种实现方式.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include //引入模板类 8 #include //引入string类库 9 using namespace std; 10 11 void CreateArray(); 12 ... 阅读全文

posted @ 2018-07-21 14:17 uimodel 阅读(181) 评论(0) 推荐(0)

C++编程基础一 21-for循环

摘要: 1 // 21-for循环.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 11 void FlipCharacter(); 12 int main() 13 { 14 ... 阅读全文

posted @ 2018-07-21 14:17 uimodel 阅读(188) 评论(0) 推荐(0)

C++编程基础一 17-指针和数组

摘要: 1 // 17-指针和数组.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 8 using namespace std; 9 10 int main() 11 { 12 int a[]{345,65,23,7,2,856,23,83,176}; 13 c... 阅读全文

posted @ 2018-07-21 14:16 uimodel 阅读(129) 评论(0) 推荐(0)

C++编程基础一 15-枚举类型

摘要: 1 // 15-枚举类型.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 using namespace std; 8 9 enum HeroType // 枚举类型是整型。适合用作标签Tag。 10 { 11 Tank, //0 12 Magic, ... 阅读全文

posted @ 2018-07-21 14:15 uimodel 阅读(131) 评论(0) 推荐(0)

C++编程基础一 16-指针

摘要: 1 // 16-指针.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 8 using namespace std; 9 10 int main() 11 { 12 13 int a = 10; //定义变量后,系统默认会给变量分配一个地址。 14 flo... 阅读全文

posted @ 2018-07-21 14:15 uimodel 阅读(120) 评论(0) 推荐(0)

C++编程基础一 14-结构体

摘要: 1 // 14-结构体.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 using namespace std; 8 9 //结构体比数组更加灵活,可以存储多种类型的多种数据。和数组一样都是复合类型。 10 11 struct Position //定义结构体 12 {... 阅读全文

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

C++编程基础一 13-字符串基于string

摘要: 1 // 13-字符串基于string.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 #include //引入string类库 8 using namespace std; 9 10 11 int main() 12 { 13 string str1; 1... 阅读全文

posted @ 2018-07-21 14:13 uimodel 阅读(190) 评论(0) 推荐(0)

C++编程基础一 12-字符串

摘要: 1 // 12-字符串.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 using namespace std; 8 9 int main() 10 { 11 //C语言的写法: 12 //错误的写法:没有'\0',在C语言中字符串是存在字符数组中的,'\... 阅读全文

posted @ 2018-07-21 14:13 uimodel 阅读(153) 评论(0) 推荐(0)

C++编程基础一 11-数组

摘要: 1 // 11-数组.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 using namespace std; 8 // 数组是复合类型,能够存储多个相同类型的数据。 9 int main() 10 { 11 12 char cArray[10]; 13 ... 阅读全文

posted @ 2018-07-21 14:11 uimodel 阅读(196) 评论(0) 推荐(0)

C++编程基础一 09-类型转换

摘要: 1 // 09-类型转换.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 using namespace std; 8 9 10 void SwitchStature(); 11 void SwitchUnit(); 12 void Percent... 阅读全文

posted @ 2018-07-21 14:08 uimodel 阅读(152) 评论(0) 推荐(0)

C++编程基础一 08-算数运算符

摘要: 1 // 08-算数运算符.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 using namespace std; 8 9 int main() 10 { 11 //+ - * / % 加减乘除余(模) 12 int a; 13 cout > a... 阅读全文

posted @ 2018-07-21 14:08 uimodel 阅读(185) 评论(0) 推荐(0)

C++编程基础一 07-浮点类型

摘要: 1 // 07-浮点类型.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 using namespace std; 8 9 10 int main() 11 { 12 //12.34 89704.45 8.0 0.454213 13 //E表示法... 阅读全文

posted @ 2018-07-21 14:07 uimodel 阅读(236) 评论(0) 推荐(0)

C++编程基础一 06-布尔类型

摘要: 1 // 06-布尔类型.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 using namespace std; 7 8 int main() 9 { 10 bool a = true; //真 存在的 非零 1 11 bool b = false;//假 不存在 零 0 ... 阅读全文

posted @ 2018-07-21 14:06 uimodel 阅读(130) 评论(0) 推荐(0)

C++编程基础一 05-字符

摘要: 1 // 05-字符.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 using namespace std; 7 8 int main() 9 { 10 //''里的都是字符 11 char c = 'a'; 12 char c2 = ' '; 13 char c... 阅读全文

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

C++编程基础一 04-整型

摘要: 1 // 04-整型.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include 7 using namespace std; 8 9 int main() 10 { 11 short a = 3; 12 int b = 100; //变量赋值需考虑变量范围,不能超过最大值... 阅读全文

posted @ 2018-07-21 13:57 uimodel 阅读(178) 评论(0) 推荐(0)

C++编程基础一 03-变量

摘要: 1 // 03-变量.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 using namespace std; 7 int main() 8 { 9 int level = 14;//变量的定义并初始化,给变量第一次赋值的过程称为初始化。 10 cout << level << en... 阅读全文

posted @ 2018-07-21 13:46 uimodel 阅读(125) 评论(0) 推荐(0)

C++编程基础一 01-我的第一个项目

摘要: 1 // 01-第一个项目.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" //自己创建的文件。 header .h结尾的都是头文件。 5 #include //系统内置的文件。#include 预处理指令,把系统内置的iostream(输入输出流)先引入进来。cout属于iostream 6 //using namespace... 阅读全文

posted @ 2018-07-21 13:04 uimodel 阅读(173) 评论(0) 推荐(0)

导航