自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 6种基础排序算法

#include<iostream>using namespace std;int temp[10];class SORT {public: SORT() { for (int i = 0; i < Arrzy_Size; i++) { cout << "请输入第"<<i+1<<"个数:"; cin >> a[i]; } cout << "-----------------------" &

2022-05-24 22:06:26 98

原创 链表中结点的插入和删除

//在第i个位置插入元素e(带头结点的链表)bool ListInsert(LinkList &L, int i, ElemType e)//后插法{ if (i < 1) return false; /******不带头结点时需要加上这段***********/ //if (i == 1) //{ // LNode *s =(LNode *)malloc(sizeof(LNode)); // s->data = e; // s->next = L->n

2022-05-08 12:14:10 419

原创 链表的定义和初始化(C语言代码)

首先是链表的定义typedef int ElemType;//指定结点中元素的类型typedef struct LNode LNode;//修改类型别名让代码更简洁struct LNode //定义一个结点类{ ElemType data; struct LNode*next;};如果上面的定义还不够简洁的话我们可以采用下面的这种方式typedef int ElemType;typedef struct LNode{ ElemType data;//每个结点存放一个数据元素

2022-05-08 12:09:01 1369

原创 关于C语言一维数组的地址问题

今天看到一道面试题int arr[5] = { 1,2,3,4,5 };则 cout << * ( *(&arr + 1) - 1) << endl;的结果是什么#include<iostream>#include<fstream>#include<string>using namespace std;int main(){ int arr[5] = { 1,2,3,4,5 }; cout << *(*

2022-05-07 12:41:45 420

原创 常量指针和指针常量的区别,读法,以及引用和this指针的本质

关于指针常量和常量指针指针常量:顾名思义就是一个常量,只不过这个常量是个指针,这个常量的值(也就是指针存储的地址)不可改变,但可以改变值(也就是这个指针所指地址的内容)具体的用法:*号在const左边,读作指针常量既然是常量那必须初始化啊。通过上图我们可以知道:1.指针常量一旦初始化那它指向不可改变。2.指针常量可以通过解引用改变指向对象的值。引用的本质:一个指针常量我们可以清楚的看到,引用的用法和指针常量一致常量指针:顾名思义,本质是一个指向常量的指针,可以改变指向(也就是指

2022-05-04 15:06:56 522

原创 deque和vector容器评委打分项目

#include<iostream>using namespace std;#include<vector>#include<algorithm>#include<string>#include<deque>#include<ctime>class Person {public: Person(string na, int s) :name(na), score(s) {} string n

2022-03-14 16:40:24 65

原创 vector存放自定义数据类型(类和指针)

#include<iostream>using namespace std;#include<vector>#include<string>class Person {public: Person(int age, string name) { this->age = age; this->name = name; } int age; string name; };void test01(){ vector<Per

2022-03-10 19:39:14 562

原创 关于vector容器的使用

在这里插入代码片#include<iostream>using namespace std;#include<vector>#include<algorithm>void myprint(int val){ cout << val << endl;}void test01(){ vector<int> v;//创建一个vector容器 v.push_back(10);//向容器中插入数据 v.push_back(

2022-03-10 19:16:32 78

原创 c++中友元的使用

全局函数做友元#include<iostream>using namespace std;class Person{ friend void guy(Person &p);//全局函数做友元可以访问私有内容 public: Person() { num = 23; age = 18; } int num; private: int age;};void guy(Person &p)//全局函数做友元{ cout <&.

2022-03-01 16:20:05 383

原创 const修饰成员函数以及常量指针和指针常量

#include<iostream>using namespace std;class Person{public: void fun() const //成员函数后加const为常函数 { this->a = 100;//加关键字mutable后,在常函数中依然可以修改 // this->b = 100; 常函数内不可修改成员属性 } void fun2() { b = 100; } int b; int mutable a;//加关键字mu

2022-03-01 15:05:38 81

原创 静态成员变量和静态成员函数

#include<iostream>using namespace std;class Person{public: static int a;//所有对象共享一份数据 test02 //类内定义 ,类外初始化 //编译阶段分配内存,全局区 int c; static void show() { cout << a << endl; //cout << c << end

2022-02-28 16:46:01 102

原创 关于类中成员含有其他类时,构造函数和析构函数的执行顺序

#include<iostream>using namespace std;#include<string>class Phone{public: Phone(string phone) { phonename = phone; cout <<"释放" <<phonename << endl; } ~Phone() { cout << "释放手机" << endl; }private:

2022-02-27 23:28:14 587

原创 【黑马C++入门 通讯录管理系统】2022.2.26

#include <iostream>#include <string>using namespace std;struct Person{ string m_Name; //名字 string m_Sex; //性别 1男2女 int m_Age; //年龄 string m_Phone; //电话 string m_Addr; //住址};#define Max 1000 // 最大人数struct Addressbooks{ Person pers

2022-02-26 19:14:04 119

原创 含有无符号类型的表达式

含有无符号类型的算术表达式当一个算术表达式中既有无符号数又有int值时,int会转换成无符号数,这里的int可以是其他类型。把负数转换成无符号数类似于直接给无符号数赋一个负值,结果等于这个负数加上无符号数的模。#includeusing namespace std;int main(){unsigned u = 10, u2 = 42;cout << u2 - u << endl;cout << u - u2 << endl;int

2022-01-28 02:29:57 839

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除