自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 优先队列链式

queue.hqueue.c优先队列测试.cqueue.h#include <stdio.h>#include <stdlib.h>#define datatype inttypedef struct queue{ datatype data; int high;//优先级 struct queue *pNext;}Queue, *PQueue;void init(PQueue *phead);//初始化PQueue enq(PQueue phead

2020-07-28 08:21:05 140

原创 链式队列

队列解决问题:银行3台ATM机,一张卡同时在3台ATM机上取钱。必须通过队列,一台操作完才能在下一台操作。考虑银行用户众多,用链表。简单实现方式:queue.hqueue.cmain.cqueue.h#include <stdio.h>#include <stdlib.h>#define datatype inttypedef struct queue{ datatype data; struct queue *pNext;}Queue,*PQue

2020-07-27 20:40:35 154

原创 字符串删除空格及加减法

#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>//下标法//void eatspace(char *str) { //删除空格// int i = 0;// int j = 0;//// /*while (str[i] != '\0') { //去空格// str[i] = str[j];//// if (str[i] != ' ') {// i++;//

2020-05-25 19:47:38 299

原创 memset内存清零及实现

#include <stdio.h>#include <stdlib.h>#include <memory.h>//下标法void* mymemset(void* _Dst, int _Val, unsigned int _Size) { if (_Dst != NULL) { return NULL; } for (int i = 0; i < _Size; i++) { ((char *)_Dst)[i] = _Val; //下

2020-05-13 10:56:30 1953

原创 memcpy

#include <stdio.h>#include <stdlib.h>#include <string.h>#include <memory.h>//下标法void* mymemcpy(void* _Dst, void const* _Src, unsigned int _Size) { if (_Dst == NULL || _Src == NULL) { return NULL; } char * ndest = _Dst;

2020-05-12 18:59:11 143

原创 锯齿数组

#include <stdio.h>#include <stdlib.h>#define N 10void main() { int **pp = malloc(sizeof(int *)*(2 * N - 1)); for (int i = 0; i < N; i++) { pp[i] = malloc(sizeof(int)*(N - i)); for (int j = 0; j < N-i; j++) { pp[i][j] = j +

2020-05-09 16:37:35 911

原创 字符串排序

#include <stdio.h>#include <stdlib.h>#include <string.h>int com(const void *p1, const void *p2){ const char **pstr1 = p1; const char **pstr2 = p2;//转化类型 return strcmp(*ps...

2020-05-06 12:11:04 99

原创 快速排序法(二)

#include <stdio.h>#include <stdlib.h>#include <time.h>void fill(int *a,int n) //填充随机数{ time_t ts; unsigned int num = time(&ts); srand(num); for (int i = 0; i < n; i...

2020-05-06 10:41:42 63

原创 快速排序法

大数据单线程最快,多线程用希尔#include<stdio.h>#include <stdlib.h>void swap(int * pi, int *pj) { //交换 int temp = *pi; *pi = *pj; *pj = temp;}void show(int *p,int n) {//显示数组状态 printf("\n此时状态 ...

2020-05-04 18:42:11 102

原创 简单程序结果显示到网页Apache(c)

首先安装轻量级服务器到电脑,傻瓜式安装。VS2015用C写的程序中需要开头末尾添加上去后生成去文件中找到生成的exe文件,修改文件后缀名 .cgi,注意文件名用英文不要用中文。修改完成后复制,找到Apache安装目录中,粘贴到这里打开本地Interlnet网页,或者谷歌默认浏览器。127.0.0.1本机默认ip,/cgi-bin/文件名.成功显示!...

2020-04-27 10:51:38 234

原创 数组指针应用(前后置换)

#include <stdio.h>#include <stdlib.h>void rev(int *p, int n){ for (int i = 0; i < n / 2; i++) { int temp = p[i]; p[i] = p[n - 1 - i]; p[n - 1 - i] = temp; }}void revp(in...

2020-04-21 15:07:03 221

原创 多线程(检索和切割)

多线程检索.c#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>#include <time.h>#include <process.h>#include <Windows.h>int isfind=0;struct findinfo...

2020-04-20 12:50:02 97

原创 多线程和队列

queue.h#pragma once#include <process.h>#include <Windows.h>#include <stdio.h>#include <stdlib.h>#include <memory.h>#define N 100 //队列长度struct queue { int dat...

2020-04-15 17:27:46 215

原创 栈模拟台阶

#include <stdio.h>#include <stdlib.h>#include "stack.h"void main() { struct stack mystack; init(&mystack); int f1 = 1; int f2 = 2; int f3 = 4; int last = 0; for (int i = ...

2020-04-15 12:32:43 101

原创 出现次数最多和最少

#include <stdio.h>#include <stdlib.h>#define N 20int a[N] = { 1,2,3,1,2,9,9,10,11,12,1,2,1,2,2,2,1,10 ,11,98};struct password { int num;//出现的数据值 int ci;//出现的次数};struct password p...

2020-04-15 11:02:39 181

原创 数组的交集与并集

#include <stdio.h>#include <stdlib.h>#define M 20#define N 15//交集void main1() { int a[M] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 }; int b[N] = {11,12,13,14,15,16,17...

2020-04-14 17:58:30 364 1

原创 数组打印 蛇形

#include <stdio.h>#include <stdlib.h>#define N 9void main() { int a[N][N] = { 0 }; int data = 1; for (int i = 0, j = 0,k=0; k < (N + 1) / 2; k++) { while (j < N-k) {//控...

2020-04-13 22:19:56 87

原创 栈的实现

stack.h#pragma once#include <stdio.h>#include <stdlib.h>#define N 100struct stack { int data[N]; int top;//栈顶};typedef struct stack Stack;//Stack 别名void init(Stack *p);//初...

2020-04-13 17:28:10 56

原创 数据地址映射

#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>void main1() { int num1; int num2; scanf("%d%d", &num1, &num2);//从小到大 int *p1 = &num1; int *p2 =...

2020-04-12 20:53:15 172

原创 内存检索技术

指针类型不同,解析方式不同。char 1个字节int 4个字节内存地址中搜索某一个地址用到char类型指针1个字节1个字节的搜索,然后转换成4字节的int类型,就是内存检索技术 //首地址 //尾地址for(char *p=0xae0000;p<0xae2000;p++){ int *px = p; //类型转换 if(*px==88){...

2020-04-12 18:28:41 199

原创 扑克洗牌

#include <stdio.h>#include <stdlib.h>#include <time.h>void main() { int a[54]; for (int i = 0; i < 54; i++) { printf("%d ", a[i] = i); } srand((unsigned int)time(NULL)...

2020-04-11 21:14:08 132

原创 起名工具

随机生成6位密码随机输出字符串#include <stdio.h>#include <stdlib.h>#include <time.h>#include <locale.h>void main1() { time_t times; srand((unsigned int)time(&times));//取随机数种子 in...

2020-04-11 20:45:27 191

原创 高维数组初始化

#include <stdio.h>#include <stdlib.h>void main() { int a[3][4][5] = { 0 }; for (int i = 0; i < 60; i++) { a[i / 20][i % 20 / 5][i % 20 % 5] = i; } //a[i][j][k] a[i/j/k][i%...

2020-04-11 20:00:28 149

原创 二维数组转置

#include <stdio.h>#include <stdlib.h>void main() { int a[3][4] = { {1,2,3,0},{4,5,0,13},{6,7,8} }; int b[4][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 4; j++) {...

2020-04-11 18:29:14 147

原创 数组迷宫AI自动寻路(升级版)

vs2015进行分层设计:数据层,控制层,显示层。模仿工业生产,显示最短路径3表示,AImoveout函数显示1移动过程。代码结构图:AI.h#include "data.h"#include "control.h"int AIout(int AIdata[N][N],int i,int j);void AImoveout();control.h#pragma once...

2020-04-03 23:03:34 396

原创 数组迷宫AI自动寻路c

自动寻路递归寻找#include <stdio.h>#include <stdlib.h>#include <Windows.h>//数据层,存储数据int a[10][10] = { {1,0,2,0,0,0,0,0,0,0}, { 0,0,2,2,0,0,0,0,0,0 }, { 0,0,0,0,2,0,0,0,0,0 }, { 0,...

2020-03-26 21:10:54 261

原创 大数据查找c

本文范例文本模拟开房数据文本,写到文件中,初级版本:#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>char strpath[256] = "开房路径";char savepa...

2020-03-23 20:59:20 384

原创 插入排序法c

此方法适用于读取同时进行插入(读一个插一个)#include <stdio.h>#include <stdlib.h>void main1() { int a[10] = { 1,2,3,4,6,7,8,9,10,5 }; int temp = a[9]; int j = 9; //记录下标 while (j > 0 &&am...

2020-03-22 21:27:44 84

原创 二分查找法及拉格朗日查找法c

二分查找:每次砍一半进行查找拉格朗日查找:每次按照输入查找的数的比例查找#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>#define N 1024void search(int a[N],int num) { int tou = 0; int wei = N -...

2020-03-22 20:55:52 228

原创 模拟游戏迷宫界面c

VS2015#include <stdio.h>#include <stdlib.h>void show(int a[10][10]) { printf("-------------------------\n"); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { ...

2020-03-21 20:02:06 170

原创 斐波那契数组实现递归对比c

循环快于递归#include <stdio.h>#include <stdlib.h>int get(int i) { if (i == 1 || i == 2) { return 1; } else { return get(i - 1) + get(i - 2); }}void main() { int a[40]; a[...

2020-03-19 14:56:20 63

原创 冒泡排序c

冒泡排序主要思想在于把极值沉底。#include <stdio.h>#include <stdlib.h>void main1() { int a[10] = {3,5,18,9,23,5,2,1,0,2}; for (int i = 0; i < 10-1; i++) { if (a[i] > a[i + 1]) { //对比 ...

2020-03-19 14:38:05 57

原创 数组选择排序法c

时空复杂度最浪费资源的,但是最容易理解// 10 9+8 +7 +1 0(1) 0(n*N)// 100 99+ 98+1 n(n-1)/2#include <stdio.h>#include <stdlib.h>#include <time.h>void main() { time_t ts; unsigned ...

2020-03-18 15:07:38 155

原创 窗口画圆c

窗口画圆#include <stdio.h>#include <stdlib.h>#include <Windows.h>#include <math.h>#define PI 3.1415926#define R 100void main1() { int px = 400; int py = 500;/...

2020-03-17 14:33:05 259

原创 取随机数c

#include<time.h>void main(){ time_t ts; unsigned int num = time(&ts); srand(num);//随机数 int data = rand();}

2020-03-10 14:14:00 59

原创 汉诺塔的图形打印实现c

汉诺塔的图形实现是递归调用的经典案例。递归有线性递归和树状递归两种。汉诺塔属于树状递归。游戏中的寻路会经常应用递归 。递归应用有普遍的模式即为MVC模式。M:move移动数据;V:view视图初始化和显示数据;C:control控制设计如何显示。#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <st...

2020-03-09 15:15:21 270

原创 dll格式

#include <Winows.h>_declspec (dllexport) void go(){ //函数名}

2020-03-07 11:49:45 139

原创 函数中的可变参数c

在数据的大小,个数,类型是未知的情况下,会用到可变参数。例如加法中,需要很多个数加起来。#include <stdio.h>#include <stdlib.h>#include <stdarg.h>//标准参数,解决可变参数问题int add(int num,...){//...意味着可变参数 int res=0;//结果 va_list a...

2020-03-05 15:03:46 75

空空如也

空空如也

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

TA关注的人

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