
c c++学习
老九君学习项目 书籍学习等
jielin1994
这个作者很懒,什么都没留下…
展开
-
C语言extern关键字
C语言正确使用extern关键字利用关键字extern,可以在一个文件中引用另一个文件中定义的变量或者函数extern关键字,C语言extern关键字用法详解原创 2020-12-31 10:02:44 · 175 阅读 · 0 评论 -
如何用通俗易懂的语言解释脚本(script)是什么?
参考文献假设你经常从网上下东西,全都放在 D 盘那个叫做 downloads 的文件夹里。而你有分类的癖好,每周都要把下载下来的图片放到 pic 文件夹里,pdf 放到 book 文件夹里,mp3 和 wma 文件放到 music 文件夹里。手动分了一年之后你终于厌倦了,于是你打开记事本,写了以下的三行字:copy /Y D:\download*.jpg D:\pic\copy /Y D:\download*.pdf D:\book\copy /Y D:\download*.mp3 D:\music原创 2020-12-20 14:15:24 · 4916 阅读 · 1 评论 -
大端模式和小端模式详解
https://blog.youkuaiyun.com/qq_26359171/article/details/77096244原创 2020-12-20 14:07:19 · 357 阅读 · 0 评论 -
STL综合题:歌唱比赛
1. 比赛机制某学校举行一场唱歌比赛,共有24个人参加,按参加顺序设置参赛号(参赛号为100至123)。每个选手唱完一首歌之后,由10个评委分别打分。该选手的最终得分是去掉一个最高分和一个最低分,求得剩下的8个评分的平均分。比赛共三轮,前两轮为淘汰赛,第三轮为决赛。选手的名次按得分降序排列,若得分一样,按参赛号升序排名。第一轮分为4个小组,根据参赛号顺序依次划分,比如100-105为一组...原创 2020-03-31 12:05:49 · 807 阅读 · 0 评论 -
容器的共通能力 各个容器的使用时机 常用算法
1.容器的共通能力2.各个容器的使用时机3.常用算法3.1知识点3.2源程序#include <iostream>#include <string>#include <time.h>#include <vector>#include <set>#include <algorithm>#in...原创 2020-03-18 09:30:42 · 155 阅读 · 0 评论 -
容器map/multimap的使用方法
1.知识点2.源程序#include <iostream>#include <string>#include <tchar.h>#include <map>using namespace std;int _tmain(int argc, _TCHAR* argv[]){ //1.map对象的默认构造 cout <<...原创 2020-03-09 19:40:29 · 148 阅读 · 0 评论 -
容器deque ,queue,stack 和 list
1.deque2. queue,stack3.list原创 2020-03-09 10:52:09 · 160 阅读 · 0 评论 -
STL 中的 set/multiset functor pair
1.知识点2.源代码#include <iostream>#include <string>#include <tchar.h>#include <set>using namespace std;int _tmain(int argc, _TCHAR* argv[]){ //1.set/multiset对象的默认构造 //set...原创 2020-03-09 10:04:12 · 126 阅读 · 0 评论 -
C++ Primer Plus(第6版) 第7章 函数总结
函数是C++的编程模块。要使用函数,必须提供定义和原型,并调用该函数。函数定义是实现函数功能的代码;函数原型描述了函数的接口:传递给函数的值的数目和种类以及函数的返回类型。函数调用使得程序将参数传递给函数,并执行函数的代码。在默认情况下,C++函数按值传递参数。这意味着函数定义中的形参是新的变量,它们被初始化为函数调用所提供的值。因此,C++函数通过使用拷贝,保护了原始数据的完整性...原创 2020-01-09 21:26:40 · 176 阅读 · 0 评论 -
C++ Primer Plus(第6版)第4章 程序清单4.23改编
源代码// some type combinations#include <iostream>struct antarctica_years_end{ int year;};using namespace std;int main(){ antarctica_years_end s01, s02, s03; /** 创建结构变量 */ s0...原创 2019-10-31 11:19:51 · 271 阅读 · 1 评论 -
容器vector与迭代器
1.源程序#include <iostream>#include <tchar.h>#include <vector> using namespace std;int _tmain(int argc, _TCHAR* argv[]){ //1.vector对象的默认构造 //vector采用模板类实现,vector对象的默认构造形式:vect...原创 2020-03-04 12:33:39 · 233 阅读 · 0 评论 -
函数模板和类模板
1.源代码#include <tchar.h>#include <iostream>using namespace std;//1.函数模板//int qjh_max(int a, int b)//{// return a > b ? a : b;//}//char qjh_max(char a, char b)//{// return a &...原创 2020-03-03 11:11:32 · 263 阅读 · 0 评论 -
string类
1.源代码#include <iostream>#include <string>using namespace std;int main(){ cout << "1.演示string的存取字符操作\n"; string s1 = "abcdefgh"; char ch1 = s1[0]; char ch2 = s1.at(1); cou...原创 2020-03-01 20:58:42 · 243 阅读 · 0 评论 -
TCHAR的作用、typedef简介和ASCII,ANSI与Unicode的区别与联系
1.编码ASCII 码使用指定的7 位二进制数组合来表示128 种可能的字符。标准ASCII 码也叫基础ASCII码,使用7 位二进制数(剩下的1位二进制为0)来表示所有的大写和小写字母,数字0 到9、标点符号,以及在美式英语中使用的特殊控制字符。ANSI编码是一种对ASCII码的拓展:ANSI编码用0x00–0x7f (即十进制下的0到127)范围的1 个字节来表示 1 个英文字符,超出一个...原创 2020-02-20 17:14:53 · 1604 阅读 · 0 评论 -
掌握C++——C++基本概念回顾 孙鑫教程整理笔记
源程序#include <iostream>using namespace std;class Animal{public: Animal()//无参构造函数(即默认构造函数) { cout << "animal construct" << endl; cout << "******************\n"; } An...原创 2020-02-06 14:03:12 · 174 阅读 · 0 评论 -
运算符重载
源程序main.cpp#include <iostream>#include "Integer.h"using namespace std;void TestInteger();int main(){ TestInteger(); return 0;}void TestInteger(){ Integer int1(1024), int2...原创 2019-10-13 21:24:06 · 160 阅读 · 0 评论 -
this指针
this 是 C++ 中的一个关键字,也是一个 const 指针,它指向当前对象,通过它可以访问当前对象的所有成员。所谓当前对象,是指正在使用的对象。例如对于stu.show();,stu 就是当前对象,this 就指向 stu。源程序main.cpp#include <iostream>#include <string>#include "Student.h"...原创 2019-10-13 17:51:02 · 164 阅读 · 0 评论 -
使用类创建对象
项目程序main.cpp#include <iostream>#include <string>#include "Landowner.h"using namespace std;int main(){ Landowner* ptr_Landower1 = new Landowner(); Landowner* ptr_Landower2...原创 2019-10-13 13:16:55 · 449 阅读 · 0 评论 -
美少女养成记---基本信息录入
#include <iostream>#include <iomanip> //io代表输入输出,manip是manipulator(操纵器)的缩写#include <ctime> //ctime分函数和类两种用途。ctime功能是把日期和时间转换为字符串, //而ctime类的对象表示的时间是基于格林威治标准时间(GMT)的...原创 2019-09-24 20:49:15 · 146 阅读 · 0 评论 -
函数练习--升级小公举
main.cpp#include <iostream>#include "GZDemo.h"using namespace std;int main(){ int array_values[5]; input(array_values,5); //C++ 传数组给一个函数,数组类型自动转换为指针类型, //因而传的实际是地址。 show_input(...原创 2019-09-25 19:29:51 · 114 阅读 · 0 评论 -
使用数组作为函数参数2
原数组元素值被修改#include <iostream>using namespace std;void show(int[], int);int main(){ int valueArray[] = {90, 56, 67, 89, 100}; show(valueArray, 5); show(valueArray, 5); retur...原创 2019-09-26 09:50:34 · 146 阅读 · 0 评论 -
使用二维数组作为函数参数
法一void show(double (*)[5], int); //函数声明void show(double (*arr)[5], int len){ }; //函数实现#include <iostream>using namespace std;void show(double (*)[5], int);int main(){ double powe...原创 2019-09-26 11:13:07 · 239 阅读 · 0 评论 -
函数指针
函数指针有两个用途:调用函数、做函数的参数C++ Primer Plus函数指针 7.18//fun_ptr.cpp--pointers to functions#include <iostream>using namespace std;double betsy(int);double pam(int);//second argument is pointer t...原创 2019-09-27 19:26:21 · 144 阅读 · 0 评论 -
函数重载练习
源代码#include <iostream>using namespace std;//使用函数重载实现数组的排序void Sort(int[], int len);void Sort(float[], int len);//重载,函数名相同,参数列表(特征标)不同void Sort(double[], int len);void show(int[], int l...原创 2019-10-08 10:47:58 · 354 阅读 · 0 评论 -
函数模板
对比一下函数重载那一篇程序#include <iostream>using namespace std;//使用函数模板实现数组的排序template<typename T_Sort> void Sort(T_Sort[], int len);template<typename T_show> void show(T_show[], int le...原创 2019-10-08 17:17:23 · 99 阅读 · 0 评论 -
美少女养成记---根据月日计算星座
#include <iostream>#include <iomanip> //io代表输入输出,manip是manipulator(操纵器)的缩写#include <ctime> //ctime分函数和类两种用途。ctime功能是把日期和时间转换为字符串, //而ctime类的对象表示的时间是基于格林威治标准时间(GMT)的...原创 2019-09-24 19:47:27 · 214 阅读 · 0 评论