![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 52
逆水上岸爱寻酱
一个有趣的灵魂
展开
-
第七章、函数
7.1函数简介1、函数的定义2、函数的调用3、函数的作用域4、参数5、返回值6、静态局部对象7.2参数传递1、按值传递#include <iostream>#include <string>using namespace std;// 按值传递void printThings(int intNum, float floatNum, string str) { cout << "打印整数:" << intNum <<原创 2021-12-21 09:31:44 · 72 阅读 · 0 评论 -
第六章、数组与指针
可以更直接地接触到内存,高效的同时存在更大的风险。一般情况下使用vector更好6.1数组与vector不同,数组是一种静态的数据结构,在初始化的时候就必须指定大小,且不能作为左值被修改。不能被重新赋值。#include <iostream>using namespace std;// 数组的操作int main() { int arr1[5] = { 0, 1, 2, 3, 4 }; int arr2[5] = { 0, 1, 2 }; int arr3[] = { 0,原创 2021-12-19 22:24:01 · 51 阅读 · 0 评论 -
第五章、vector与字符串
C++标准库中常见的两种数据结构:vector、stringvector:可以表示一串数据序列string:表示字符串序列函数size() 构造函数vector<int>vecl(2)5.1、vectorvector是标准库中的类,使用vector需要包含标准库的头文件1、vector创建和初始化#include <iostream>#include <vector>using namespace std;int main() { vec原创 2021-12-17 14:51:22 · 187 阅读 · 0 评论 -
第四章、流程控制与语言结构
4.1简单语句4.2条件控制语句1、if语句 if ( num < 4 ) { cout << "数字小于4。" << endl; } else if ( num > 6 ) { cout << "数字大于6。" << endl; } else { cout << "数字在4和6之间。" << endl; }2、switch语句switch(num){case0: cout原创 2021-12-17 13:54:37 · 270 阅读 · 0 评论 -
第三章:C++基础语法
3.1基本内置类型char 8wchar_t 16short 16int 16long int 32float 6位有效数字double 10位有效数字long double 10位有效数字bool3.2变量与原创 2021-12-15 23:15:28 · 726 阅读 · 0 评论