![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言
恰似清分吹过
这个作者很懒,什么都没留下…
展开
-
c++堆排序
#include <iostream>using namespace std;#include <string.h>#include <vector>void maxheap(vector<int>& ans,int i,int n){ int l = i * 2 + 1; int r = i * 2 + 2; int max = i; if(l < n && ans[l] > an原创 2020-07-12 11:27:30 · 108 阅读 · 0 评论 -
c++归并排序
#include <iostream>using namespace std;#include <string.h>#include <vector>void merge(int low,int mid,int high,vector<int>& ans,vector<int>& tem){ int l = low; int h = mid + 1; int k = low; while(l原创 2020-07-12 10:54:26 · 89 阅读 · 0 评论 -
c/c++二叉树的前中后遍历
#include <stdio.h>#include <stdlib.h>typedef struct _tree{ char data; struct _tree *left; struct _tree *right;}tree;typedef struct _stack{ tree **data; int top;...原创 2020-04-06 20:16:13 · 122 阅读 · 0 评论 -
c/c++栈的链式存储
.h#ifndef MYSTACK_H#define MYSTACK_Htypedef struct _node{ char data; struct _node *next;}Node;class mystack{public: mystack(); int isempty(); void push(char data); ch...原创 2020-04-05 19:57:48 · 137 阅读 · 0 评论 -
C++栈的实现
.h#ifndef STATCK_H#define STATCK_Hclass statck{public: statck(int len); ~statck(); int isempty(); int isfull(); void push(char data); char pop();private: int len; ...原创 2020-04-05 19:53:16 · 89 阅读 · 0 评论 -
c语言队列的实现
线性队列#include <stdio.h>#include <stdlib.h>typedef struct _node{ char *space; int len; int front; int rear;}queue;void init(queue* q,int len){ q->len = len; ...原创 2020-04-05 19:49:45 · 113 阅读 · 0 评论 -
C语言单向链表
头文件#ifndef MYLIST_H#define MYLIST_H#endif // MYLIST_Htypedef struct _Node{ int data; struct _Node *next;}Node;Node *creatList();void traverList(Node *head);int strlenList(Node *head...原创 2019-10-11 22:14:49 · 97 阅读 · 0 评论 -
逆置字符串保存
/*将逆置的字符串保存*/void strReverse(char *buf,char *bufSave){ if(*buf) { strReverse(buf+1,bufSave+1); strncat(bufSave,buf,1); }}int main(void){ char buf[100] = "china";...原创 2019-09-02 20:38:12 · 198 阅读 · 0 评论 -
字符串去除空格,解决文件登陆问题
#include <stdio.h>#include <stdlib.h>/*去除左边空格*/void trimLeftSpace(char *p){ if(*p != ' ') return; char *str = p; while(*str == ' ') str++; while(*p++ = ...原创 2019-09-02 20:17:08 · 93 阅读 · 0 评论 -
strtok实现原理
#include <stdio.h>#include <string.h>#include <stdlib.h>static char *olds;static char *save_ptr;char *strtok1(char *s, const char *delim) { char *token; if (s == NULL)...原创 2019-08-26 20:48:10 · 230 阅读 · 0 评论 -
C语言数组的几种排序方法
#include <stdio.h>#include <time.h>/*快速排序法*/void quickSort(int *p,int low,int high){ if(low < high) { int temp = p[low]; int l = low; int h = high; ...原创 2019-08-23 15:46:38 · 1949 阅读 · 0 评论 -
strchr函数的实现与对比
strchrstrchr 函数介绍函数声明 char strchr(char str,char ch),包含在头文件string.h中。函数功能:返回字符串str中首次出现字符ch的指针,没有 则返回NULL。#include<stdio.h>#include <string.h>/*统计一个字符在字符串内出现的次数*/int calcCharCountOfS...原创 2019-05-16 10:27:38 · 236 阅读 · 0 评论 -
C语言双向链表
包含双向链表的创建,插入,遍历,查找,排序,删除,销毁。#include <stdio.h>typedef struct node{ int data; struct node *next; struct node *pre;}Node;Node *creatList(){ Node *head = (Node*)malloc(sizeo...原创 2019-05-27 15:15:07 · 177 阅读 · 2 评论 -
C语言将文件写入到堆内存中
我是黑体字我是微软雅黑我是华文彩云color=#0099ff size=72 face=“黑体”color=#00ffffcolor=gray#include <string.h>#include <stdio.h>#include <stdlib.h>int main(int argc, char *argv[]){ char b...原创 2019-08-23 21:09:20 · 621 阅读 · 0 评论 -
自实现strlen,strcpy,strcat,strcmp
strlenint mystrlen(const char *src){ int len = 0; while(*src++) len++; return len;}strcpychar *mystrcpy(char *dest,const char *src){ char *d = dest; while(*dest++ = ...原创 2019-08-24 09:14:46 · 106 阅读 · 0 评论 -
strchr,strstr自实现
#include <stdio.h>#include <stdlib.h>int strchrcount(char *src,char ch){ int count = 0; while(*src) { if(*src == ch) count++; src++; } r...原创 2019-08-25 09:04:38 · 129 阅读 · 0 评论 -
C语言快速排序
#include <stdio.h>#include <time.h>void quickSort(int *p,int low,int high){ if(low < high) { int tem = p[low]; int l = low; int h = high; whil...原创 2019-08-22 10:56:23 · 140 阅读 · 0 评论