自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 吉林大学算法分析与设计期末复习简答总结

吉林大学算法分析与设计期末复习总结

2024-06-03 19:44:18 1525

原创 数据结构实验

​。

2023-11-26 16:00:06 1735

原创 c++面向对象课程笔记

计算机软件专业面向对象oop课程笔记

2023-11-18 22:16:21 131

原创 数据结构算法题

吉林大学数据结构实验班作业题

2023-11-18 22:14:06 65

原创 构造函数的分类及调用

#include<iostream>#include<string>using namespace std;//构造函数的分类及调用//按照参数 有参和无参//按照类型分类 普通构造 和 拷贝构造class person{public: person()//无参构造函数 { cout << "person的构造函数调用" << endl; } person(int a)//有参构造函数 { cout << "pe.

2022-04-06 13:25:00 562

原创 点和圆的关系案例

#include<iostream>#include<string>using namespace std;#include"circle.h"#include"point.h"//class point//{//public:// void setx(int x)// {// m_x = x;// }// void sety(int y)// {// m_y =y ;// }// int getx()// {// return m_x ;.

2022-04-05 19:44:41 202

原创 设计一个立方体类(封装)

#include<iostream>#include<string>using namespace std;//设计立方体类//求出立方体的面积和体积//分别用全局函数和成员函数判断两个立方体是否相等class cube{ //行为(获取长宽高)(立方体的面积)(体积) //属性public: //设置长 void setl(int l) { m_l = l; } int getl() { return m_l; } void setw(.

2022-04-05 16:50:08 122

原创 成员属性私有化

#include<iostream>#include<string>using namespace std;//成员属性设置为私有class person{public: void setname(string name) { m_name = name; } string getname() { return m_name; } int age() { m_age = 0; return m_age; } void setlover.

2022-04-05 13:08:12 71

原创 struct 和 class 的区别

#include<iostream>#include<string>using namespace std;//struct 和 class的区别:默认权限的不同class c1{ int m_a;//默认权限 是私有};struct c2{ int m_a;//默认权限 是公共};int main(){ c1 cc1;// cc1.m_a;//error 私有权限不可以被访问 c2 cc2;//可以被访问,struct 可以被访问 system.

2022-04-05 12:53:48 41

原创 三种权限访问

#include<iostream>#include<string>using namespace std;//访问权限总共有三种//公共权限 public 成员类内可以访问 类外可以访问//保护权限 protected 类内可以访问 类外不可以访问//私有权限 private 类内可以 类外不可以class person{public://公关权限 string m_name;protected://保护权限 string m_car;p.

2022-04-05 12:49:27 236

原创 类和对象(c++核心)

c++面向对象的三大特性:封装,继承,多态c++认为万事万物都有对象,对象上有其属性和行为具有相同性质的对象,我们抽象为一个类一、封装将属性和行为作为一个整体,表现生活中的事物将属性和行为加以权限控制设计了一个类:class#include<iostream>using namespace std;const double PI = 3.1415926;//设计一个圆类,求圆的周长//class代表设计一个类,类后面紧跟着的就是类名称class circl

2022-04-04 22:38:37 593

原创 函数重载(函数名字可以相同)

#include<iostream>using namespace std;//函数重载 //作用:函数名可以相同,提高复用性//函数重载的满足条件//1.同一个作用域下(全局作用域)//2.函数名称相同//3.函数参数的类型不同,或者个数不同,或者顺序不同void func(){ cout << "func的调用" << endl;}//int func()//{// cout << "func的调用" << end.

2022-04-04 22:00:09 1339

原创 站位参数的使用(后面会有用)

#include<iostream>using namespace std;//返回值类型 函数名(数据类型){}//目前阶段的站位参数,后面会用到//站位参数 还可以有默认参数void func(int a,int)//站位参数{ cout << "this is a func" << endl;}int main(){ func(10,10); system("pause"); return 0;}...

2022-04-04 21:49:07 269

原创 函数的默认参数

#include<iostream>using namespace std;//函数的默认参数//如果我们自己传入了数据,就用自己的数据,如果没有就用默认值//语法:返回值类型 函数名(形参=默认值)int func(int a, int b=20, int c=30){ return a + b + c;}//注意事项//1.如果某个位置已经有了默认参数,那么从这个位置开始,从左到右都必须有默认值//int func2(int a, int b=10, int c)//.

2022-04-04 21:43:21 311

原创 引用:给变量起别名(本质->指针常量)

#include<iostream>using namespace std;//引用:给变量起别名int main() { int b=0; int& a = b; a = 10; cout <<"b="<< b << endl; cout <<"a="<< a << endl; b = 10000; cout << "b=" << b << endl; .

2022-04-04 13:45:46 94

原创 new,delete关键字

#include<iostream>using namespace std;int * func(){ int * p=new int(10); return p;}void test02()//开辟数组{ int * arr=new int[10]; for (int i = 0; i < 10; i++) { arr[i] = i + 100; } for (int j = 0; j < 10; j++) { cout << ar.

2022-04-04 13:04:51 97

原创 全局区(变量和常量)栈区、堆区

栈区的数据由编译器管理,不要返回局部变量的地址堆区的空间由程序员释放,程序结束后由操作系统释放#include<iostream>using namespace std;int* func(){ //利用new关键字 可以将数据开辟到堆区 //指针变量是在栈上的,本质也是局部变量 int * p=new int(10); return p;}int main() { int * p = func(); cout << *p << e..

2022-04-03 22:51:14 609

原创 c++关于对数组冒泡排序

#include<iostream>using namespace std;void bubblesort(int *arr,int len){ for (int i = 0; i < len - 1; i++) { for (int j=0; j < len - i - 1; j++) { if (arr[j] > arr[j + 1]) { int t = arr[j]; arr[j] = arr[j + 1]; ar.

2022-04-03 15:40:36 737

原创 指针常量const

1.const修饰的是指针,指针指向可以改,指针指向的值不能改const int *p1=&a;2.const修饰的是常量,指针指向不可以改,指针指向的值可以改int * const p2=&a3.const既修饰指针又修饰常量const int * const p3=&a...

2022-04-03 11:26:57 196

原创 位运算符c语言

#include<stdio.h>//位运算符可以对数据的操作精确到每一位int main(void){ int i = 5;//0101 int j = 7;//0111 int k; k = i & j;//按位与& 二进制每一位比较真假 //1&1=1 0&0=0 1&0=0 printf("%d\n", k); k = i && j;// 逻辑运算符 printf("%d\n", k); k = i |.

2022-04-01 13:24:43 218

原创 链表遍历示意图

#include<stdio.h>//链表遍历示意图#include<malloc.h>#include<stdbool.h>struct node{ int data; struct node * pnext;};//链表struct node *creatlist();void traverselist();bool emptylist(struct node* phead){ if (phead->pnext == NULL) r.

2022-03-31 23:33:44 281

原创 enum枚举

#include<stdio.h>enum weekday//定义了一个数据类型,并没有定义变量 { Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday};int main(void){ enum weekday day = Wednesday; printf("%d\n", day); return 0;}

2022-03-30 21:46:06 194

原创 动态构造存放学生管理系统

#include<stdio.h>//动态构造存放学生管理系统#include<malloc.h>struct student{ int age; float score; char name[100];};int main(void){ int len; int i,j; struct student t; struct student *parr; printf("请输入学生的人数:\n"); printf("len="); scanf("%d.

2022-03-30 18:59:22 231

原创 冒泡排序c

#include<stdio.h>void sort(int * a,int len){ int i, j, t; for (i = 0; i < len - 1; ++i) { for (j = 0; j < len - 1 - i; ++j) { if (a[j] > a[j + 1]) { t = a[j]; a[j] = a[j + 1]; a[j + 1] = t; } } }}int mai.

2022-03-30 17:57:59 221

原创 结构体变量

#include<stdio.h>#include<string.h>struct student//结构体变量不能相加,相乘,相除{ int age; char sex; char name[100];};void inputstudent(struct student *);void outputstudent(const struct student *);int main(void){ struct student x;...

2022-03-30 16:31:35 265

原创 条件运算符“?”

x=(y<2)?-y:y;如果y小于2那么输出x=-y,否则x=y。

2022-03-29 15:46:53 42

空空如也

空空如也

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

TA关注的人

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