自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 剑指offer刷题

1

2020-12-09 21:08:19 173

原创 bug:使用git往远程仓库提交代码时,提示rejected的解决办法

先pull一下,然后再push一下。 解决办法:(1)git pull origin + 干活的分支名字 (2)git push origin master + 干活的分支名字

2020-09-18 15:58:06 706

原创 “初始化”: 无法从“const char [5]”转换为“char *” 问题解决方案

因为用vs2017时遇到了这个问题,故而百度了一下,百度给的答案是,char *p=text; 我这边还是报错,后面我试了一下,加个char*,转换一下,是可以通过的,希望有道行深的道友给解释一下 这样是可以解决的。 ...

2020-08-21 14:10:03 5156 1

原创 用C++ 封装linux下的互斥锁MutexLock和条件变量Condition

/*封装互斥锁的时候,要用到的方法,20200605*/ //问题一:MutexLock和Condition是否要设计成单例模式? // 单例模式只能通过该类创建出一个对象,这意味着只能创建一把锁,如果再来一把锁的话, // 这显然不符合需求,锁可以有多把,条件变量也可以有多个 //问题二:MutexLock和Condition的成员是否要设计成static? // 不能设计成static,否则只能是唯一的 //问题三:MutexLock与Condition应该是什么关系?.

2020-06-11 18:32:05 750

原创 头文件放置位置顺序

2020-06-06 22:46:18 604

原创 C++ string

#include <string.h> //C头文件 #include <string> //C++头文件, 模板 #include <iostream> using std::cout; using std::endl; using std::string; void func(int arr[10]) //void func(int * arr) {...

2020-01-02 20:30:15 151

原创 C++中的引用的用法

#include <iostream> using std::cout; using std::endl; //将引用作为函数参数来使用 #if 0 //值传递 ==> 复制 void swap(int x, int y) { int temp = x; x = y; y = temp; } #endif //地址传递 ==> 值传递 ==> 进行复制...

2020-01-01 15:34:40 552

原创 malloc 和free,new和delete区别

C语言中的malloc和free C++ 中的new和delete #include <stdlib.h> #include <string.h> #include <iostream> using std::cout; using std::endl; //野指针 // //内存泄漏 // //内存踩踏 // //malloc/free 与n...

2019-12-31 22:39:31 204

原创 C++ 指针

#include <iostream> using std::cout; using std::endl; //当const修饰的是指针的时候 // //int(*p)[5] int * p[5] //数组指针 指针数组 //int (*p)(void) int * p() //函数指针 指针函数 // //常量指针 指针常量 v...

2019-12-31 22:13:10 126

原创 使用Linux时,如何让X-shell远程连接自己的虚拟机,配置网络

配置网络,如何让xshell远程连接虚拟机 Linux系统中,ubuntu下进入虚拟机后,使用ifconfig命令,获取虚拟机的IP地址 (1)在虚拟机中,采用DHCP,自动获取ip。(ps:也可以自己配置,选择Manual,但这样有可能和别人的IP冲突。) (2)windows系统下cmd命令窗口,获取本机ip,用ipconfig命令 在虚拟机中ping主机ip(在第2步已经获取了自己...

2019-12-29 14:23:51 1121 1

原创 简化版学生管理系统

目录 头文件 list.h list.c main.c 配置文件: stuInfor.txt stu_account.txt 学C以来,第一次写了近五百行代码,实现一个简易版的学生管理系统,把一组学生信息存入文件中,然后管理员读取信息,管理员还可以对学生信息进行增,删,改,查。除此之外...

2019-06-17 21:56:02 261

原创 对学生信息进行排序

1.用qsort #include <stdio.h> #include <stdlib.h> typedef struct{ int num; char name[20]; float chinese; float math; float english; }Student_t,*pStudent_t; #define N 5 int compareN...

2019-06-12 12:58:15 517

原创 数据结构 排序算法

选择排序 插入排序 快速排序(递归实现) qsort(实现快排非递归) #include <stdio.h> #include <stdlib.h> #include <time.h> #define N 500000 #define SWAP(a,b) {int tmp;tmp=a;a=b;b=tmp;}//宏里面实现交换,而且效率比较高 v...

2019-06-11 19:53:43 149

原创 链表的增删查改

链表的插入 头插法: 尾插法: 有序插入: #include <stdio.h> #include <stdlib.h> //头插法 输入:4 5 10 2 6 8 输出:8 6 2 10 5 4 typedef struct student { int num; struct student *pNext; }Student_t,*pStu...

2019-06-11 00:32:34 238

原创 关于递归的几个典型题目

1.台阶问题,也是斐波那契数列? (非递归的方法) f(n)=f(n-1)+f(n-2) 1 1 1种 2 1 1 2 2种 3 1 2 1 1 1 2 1 1+2=3种 4 ...

2019-06-10 20:18:15 799

原创 求一个字符串数组的最大值和次大值

#include <stdio.h> #include <stdlib.h> #include <string.h> //比较一组字符串数组的大小,并且从中找出最大值和次大值 void big(char **p, int N, char **p1, char **p2) { *p1 = strcmp(p[0], p[1]) > 0 ? p[0] : p...

2019-06-09 22:23:31 1511 1

原创 二级指针的偏移,索引式排序

增量编译 对b[5][12] = { "zhousi","chang'e","erlangshen","weinasi","liubei" }; 这里面的字符串,按字母表顺序从小到大打印出来 最初版本: 中间版本: #include <stdio.h> #include <stdlib.h> #include <s...

2019-06-09 20:29:07 545

原创 函数指针的定义

1.函数指针的定义(要掌握这个就行了)

2019-06-09 19:37:38 166

原创 字符串翻转

题目描述:输入一串字符串: hello world 输出: world hello 方法1:指针做法: #include <stdio.h> #include <stdlib.h> #include <string.h> //解决思路:第一步:把字符串由hello world 变成...

2019-06-09 15:26:32 262

原创 C语言:对指针的一些总结

1.一级指针 指针的用途:传递和偏移 #include <stdio.h> #include <stdlib.h> //指针的本质是:间接访问!!!!! int main() { int i = 3; int *iPointer;//指针变量,int*型的 scanf("%d", &i); printf("%d\n", i);//直接访问 iPoin...

2019-06-09 00:38:44 141

原创 指针与二维数组 不理解的地方

#include <stdio.h> #include <stdlib.h> #include <string.h> //说实话,这个不理解,int(*p)[4]; 意思是定义一个数组指针! void print(int(*p)[4], int row){ int i, j; printf("sizeof(*p)=%d\n", sizeof(*p)); ...

2019-06-08 22:43:27 129

转载 动态数组

动态数组 #include <stdio.h> #include <stdlib.h> #include <string.h> //真正的动态数组 #define CAPACITY 10 int main() { char *p=(char*)malloc(CAPACITY); char c; int i=0,cap=CAPACITY; while(...

2019-06-07 23:06:57 116

原创 输入一个日期,输出第二天的日期

#include <stdio.h> #include <stdlib.h> //输入今天的日期,求明天的日期 // struct date{ int year; int month; int day; }; bool isLeap(struct date d); int numberOfDays(struct date d); int main(int arg...

2019-06-02 23:28:59 6654 1

原创 字符串的几个函数

关于字符串的函数总结:strlen(),strcmp(),strcpy(),strcat() 1.strlen() 函数 size_t strlen(const char* s) 返回s的字符串长度,不包括结尾的0 #include <stdio.h> #include <string.h> //对于字符数组遍历,比较重要的一个点就...

2019-05-30 22:00:17 840

原创 字符数组

在这里插入代码 #include <stdio.h> #include <string.h> //strcmp(s1,s2); s1==s2,返回0,大于返回-1 ,小于返回1 int main(int argc,char const *argv[]){ char s1[]="cbc"; char s2...

2019-05-30 15:26:38 129

原创 学习C语言遇到的几个题目

1.100以内的素数

2019-05-29 23:58:49 140

转载 C语言中的逃逸字符

这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 欢迎使用Ma...

2019-05-26 18:35:35 2213 1

空空如也

空空如也

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

TA关注的人

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