- 博客(46)
- 问答 (9)
- 收藏
- 关注
原创 C语言,Math Dash的账户登录程序(二叉排序树)
代码如下:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <io.h>#include <stdbool.h>#include <dirent.h>typedef char *KeyType;typedef struct{ KeyType id; char *password,*file_name; unsigned long
2022-03-19 00:09:56
1139
原创 C语言二叉排序树
插入算法:void InsertBFS(BSTree *a,Elemtype b){ if(!(*a))//*如果树为空 { BSTree c; c=(BSTree)malloc(sizeof(BSTNode)); c->lchild=c->rchild=NULL; c->data=b; *a=c; } else if(b.key<(*a)->data.key)//*如果插入的结点小于树结点 { InsertBFS(&(*a)-
2022-02-22 18:46:59
1481
1
原创 C语言拓扑排序
定义:typedef char VerTexType;typedef struct{ int adjvex; struct ArcNode *next;}ArcNode;typedef struct{ VerTexType data; ArcNode *fistarc;}VNode,*AdjList;typedef struct{ AdjList vertices; int arcnum,vexnum;}ALGraph;typedef struct{ int adj
2022-01-18 21:43:39
403
原创 C语言二叉树层次遍历和通过层次遍历找出度为1的结点
层次遍历算法:void _PrintTree_f5(BiTree a){ LinkQueue b; b=InItQueue(); EnQueue(&b,a); while(!QueueEmpty(b)) { BiTree d; d=getFront(b); printf("%c\n",d->data); if(d->lchild) { EnQueue(&b,d->lchild); } if(d->rchild) .
2021-12-14 21:43:12
2513
原创 C语言中序遍历,双序遍历,前序遍历,后序遍历
前序遍历就是先访问根节点的左子树再前序遍历左子树再遍历右子树前序遍历算法如下:void _PrintTree_f2(BiTree a){ if(a)//*如果a不为空 { printf("%c\n",a->data);//*访问根结点 _PrintTree_f2(a->lchild);//*遍历左子树 _PrintTree_f2(a->rchild);//*遍历右子树 }}中序遍历就是先中序遍历根节点的右孩子再访问根节点其次中序遍历左孩子中序遍历算法
2021-12-14 12:52:10
2210
原创 C语言使用程序吓唬室友
原理:该程序连续不断的发送start指令打开命令提示符,最大不会超过200次,然后发出重新启动的指令以重启电脑代码如下:#include <stdio.h>#include <stdlib.h>main(){ int a,b; srand((unsigned)time(NULL)); a=rand();//*随机数字 for(b=1;b<=(a%200)+1;b++)//*不会超过200 { system("start");//*连续不断的发送st
2021-12-14 10:13:11
671
原创 C语言:如何将账户密码修改为随机密码并且保存?
代码如下:#include <stdio.h>#include <stdlib.h>#include <io.h>typedef struct{ char *password; struct LNode *next;}LNode,*LinkList;void InItList(LinkList *a){ *a=(LNode*)malloc(sizeof(LNode)); (*a)->next=NULL;}void file_datas(LinkList *a,char *file
2021-12-13 22:48:02
715
原创 C语言:分别用递归和非递归方法遍历所有结点
递归打算法:void InOrderTraveres(BiTree T){ if(T) { InOrderTraveres(T->lchild); printf("%d\n",T->data); InOrderTraveres(T->rchild); }}非递归算法(部分算法代码在正文):void InOrderTraveres2(BiTree T){ LinkStack S; BiTree q,p; p=T; InItStack(&S); q=(struct BiT
2021-11-25 22:13:34
421
原创 C语言:Math Dash的二叉树的第三次练习成果
#include <stdio.h>#include <stdlib.h>typedef struct BiTNode{ char data; struct BiTNode *lchild,*rchild;//*左右孩子指针}*BiTree;void InItBiTree(BiTree *a)//*初始化{ *a=NULL;}void CreateBiTree(BiTree *a)//*插入信息{ char ch; scanf("%c",&ch).
2021-11-25 01:01:27
593
原创 C语言:Math Dash练习的登录程序
代码如下:#include <stdio.h>#include <stdlib.h>#include <string.h>typedef int TElemtype;typedef struct BiTNode{ TElemtype data; struct BiTNode *lchild,*rchild;}*BiTree;void CreatTree(BiTree *a){ char *h; h=(char*)malloc(sizeof(c
2021-11-23 19:36:31
764
原创 C语言:Math Dash练习的二叉树代码(增加了清空二叉树功能,其实就是释放结点所占空间)
代码如下:#include <stdio.h>#include <stdlib.h>#include <string.h>typedef int TElemtype;typedef struct BiTNode{ TElemtype data; struct BiTNode *lchild,*rchild;}*BiTree;void CreatTree(BiTree *a){ char *h; h=(char*)malloc(sizeof(c
2021-11-22 20:45:05
263
原创 C语言:Math Dash练习的二叉树代码
代码如下:#include <stdio.h>#include <stdlib.h>#include <string.h>typedef int TElemtype;typedef struct BiTNode{ TElemtype data; struct BiTNode *lchild,*rchild;}*BiTree;void CreatTree(BiTree *a){ char *h; h=(char*)malloc(sizeof(c
2021-11-22 19:40:45
641
原创 C语言记录游戏大战僵尸游戏时长
第一步:编写代码,然后编译代码如下:#include <stdio.h>#include <stdlib.h>typedef struct{ long miao,feng,shi,day;}gametime;void PlantsVsZombiestimeGames(gametime *c){ long a; a=time(NULL); printf("正在记录游戏时间中......\r"); system("PlantsVsZombies.exe")
2021-08-30 20:46:51
542
1
原创 Math Dash的链栈程序
链栈定义:typedef struct{ int id; char password[300];}Elemtype;typedef struct{ Elemtype data;//*数据域 struct StackNode *next;.//*指针域}StackNode,*LinkStack;//*指向StackNode初始化:void InitStack(LinkStack *a){ *a=NULL;//*将结点置空}入栈:void Pop(LinkSta
2021-08-20 23:32:16
140
原创 Math Dash的栈程序
栈是限定仅在表尾进行插入或删除操作的线性表,表尾为栈顶,表头为栈底顺序栈的定义如下:typedef struct{ int id; char password[300];}SElemtype;struct SqStack{ SElemtype *data; int stacksize,length;};最大值:#define MAXSIZE 5001.初始化struct SqStack *InItStack(){ struct SqStack *a;//*
2021-08-20 15:49:43
151
原创 C语言多项式计算程序
代码如下:#include <stdio.h>#include <stdlib.h>struct data{ double coef,expn;};main(){ char ooo[]="Math Dash的多项式程序"; char ooa[strlen(ooo)+6]; sprintf(ooa,"title %s",ooo); system(ooa); puts(ooo); double b; printf("请输入多项式项数\n"); whil
2021-08-15 20:47:36
2194
原创 C语言寻找链表中最大的值
该程序的原理就是,将链表中的所有值赋值到一个指针中然后将该指针整理为有序表,最后的结点为最大值1、要编辑出以下代码,方便为另一个指针分配内存struct LNode{ int data; struct LNode *next;};struct number{ struct LNode *a0; int length;};2、寻求最大值的算法的代码如下int max(struct number a)//*寻求链表中最大值的算法{ struct LNode *b; b
2021-08-14 19:58:57
5341
原创 C语言删除值为特定值的结点
该程序的原理就是,判断该结点的值是否为特定值(item),如果是,则删除该结点删除算法如图算法代码如下:void chan_chu_item_datas(struct LNode *a){ struct LNode *b; b=a; while(b->next) { if(b->next->data==item)//*判断是否为特定值,如果是,则删除 { struct LNode *c; c=b->next; b->nex.
2021-08-14 17:46:15
300
原创 C语言将链表中的结点和其前缀互换位置
这是原双向链表,p表示该结点,c表示p的前缀图(1)如何实现将该结点和其前缀位置互换?第一步:(1)、将p的前缀指向c的前缀;(2)、将c的前缀的后缀指向b如图:图(2)第二步:(1)、将c的前缀指向p的前缀(2)、将p的前缀的后缀指向c如图:图(3)第三步:(1)、将c的前缀指向p;(2)、将p的前缀指向c;图(4)完成上述三种算法,即可实现结点和其前缀的位置交换算法代码如下:void change...
2021-08-14 12:52:03
457
原创 C语言,删除数据域超出范围的结点
该程序原理:该程序的原理就是,通过比大小来确定是否删除结点删除算法如图该算法的代码如下: struct LNode *b; b=a;//* *a代表原链表 *// while(b->next) { if(!((b->next->data<maxk)&&(b->next->data>mink)))//*通过比大小确认是否删除该结点 { struct LNode *c; c=b->next;//*
2021-08-12 21:27:14
210
原创 C语言链表的倒置
原链表如下:C语言链表如何倒置?第一步:初始化将头结点的下缀置空,然后将其作为尾结点,如图代码如下: struct LNode *b,*c; b=a;//a代表已有的链表 c=b->next;//*暂时保存头结点之后的信息 b->next=NULL;//*将b的后缀置空第二步:循环1.将原链表的第二个结点看做倒数第二个结点并将下缀指向该结点在原链表时的前缀,如图2.重复类似操作将原链表的第三个结点看做倒数第三个结点并将下缀指向该结点在原链表时的..
2021-08-12 16:51:24
2985
1
原创 Math Dash的求两个集合的交集,就是把两个集合的交集存放在第一个集合中的程序
代码如下:#include <stdio.h>#include <stdlib.h>struct LNode{ int data; struct LNode *next;};struct LNode *a0(){ struct LNode *a; a=(struct LNode*)malloc(sizeof(struct LNode));//*分配内存 a->next=NULL; return a;}struct LNode *a1(int i
2021-08-09 20:18:36
152
原创 Math Dash的两个随机数链表合并程序
代码如下:#include <stdio.h>#include <stdlib.h>#define MAXSIZE 500typedef struct{ double coef,expn;}Elemtype;typedef struct{ Elemtype *data; int length;}SquList;main();void jie_mian_List();void InitList(SquList *a);void GetsList(Sq
2021-08-09 13:51:47
152
原创 C语言Math Dash的多项式相加程序
代码主要实现将多项式转化为链表,并且利用该链表实现多项式的计算代码如下:#include <stdio.h>#include <stdlib.h>typedef struct{ float coef,expn;}Elemtype;typedef struct PNode{ Elemtype data; struct PNode *next;}*Polynomial;void InitList(Polynomial *a){ *a=(struct P
2021-08-07 19:47:01
204
原创 有序表的合并(单链表)
代码如下:#include <stdio.h>#include <stdlib.h>struct LNode{ int data; struct LNode *next;};struct LNode a0(int i){ int a,*b,c; b=(int*)malloc(i*sizeof(int)); for(a=0;a<i;a++) { b[a]=rand()%10; } for(c=0;c<i;c++) { for(a=
2021-08-07 13:58:16
353
原创 Math Dash的c语言有序表的合并
代码如下:#include <stdio.h>#include <stdlib.h>struct SquList{ int *data; int length;};main();void jie_jian_system();struct SquList *a0();struct SquList *a1();struct SquList *a2(struct SquList c,struct SquList d);main(){ jie_mian_.
2021-08-06 14:02:17
105
原创 我的双向链表管理系统(供参考)
代码如下:#include <stdio.h>#include <stdlib.h>typedef struct{ double a; double b;}Elemtype;typedef struct LNode{ Elemtype datas; struct LNode *prior; struct LNode *next;}*LinkList;main();void jie_mian_system();void
2021-08-05 21:17:02
169
原创 如何用尾插法建立双向链表(C语言)
双向链表的尾插法同单链表的尾插法一样,通过将新结点逐个插入链表的尾部来创建链表,将链表尾部的结点的指针域指向后缀,不同的是新结点不仅需要将链表尾部结点的后缀指针域指向新结点,还需要将新结点的前缀指向链表尾部结点单链表的头插法访问网址:https://blog.youkuaiyun.com/weixin_45592399/article/details/103291250?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162746598816780
2021-07-28 18:11:11
2439
原创 C语言用前插法实现链表的倒置
此方法的原理:通过一次次的把旧链表的信息导出,再一次次的用前插法把旧链表的信息导入新链表,从而实现链表的倒置前插法:前插法是通过将新结点逐个插入链表的头部(头结点之后)来创建单链表,每次申请一点,读入相应的数据元素值,然后将新结点插入到头结点之后代码如下:#include <stdio.h>#include <stdlib.h>struct Test{ int data; struct Test *next;};struct Test Math
2021-07-28 00:13:29
506
原创 c语言实现两个链表的相连
代码如下:#include <stdio.h>#include <stdlib.h>typedef struct{ int a1; int a2;}Elemtype;struct LNode{ Elemtype data; struct LNode *next;};int main(int argc, char *argv[]){ struct LNode *boy,*boy3; boy3=(struct LNode*)malloc(sizeof(
2021-07-25 22:11:49
1763
原创 我的第一个顺序表程序
顺序表,其实就是类似列表的信息,这是我的第一个顺序表代码,把一些信息添加到对应的位置上,就可以了代码如下:#include <stdio.h>#include <stdlib.h>typedef struct{ char *name; char *id;}Elemtype;typedef struct{ Elemtype data; struct Node* admin;}LinkList,*Node;Elemtype datas[]={{"My l
2021-07-25 20:55:05
94
原创 我的盈亏计算器
代码如下:#include <stdio.h>#include <stdlib.h>int main(int argc, char *argv[]){ int a,c; double b,d=0,e; puts("请输入盈亏次数"); while((scanf("%lf",&b)!=1)||((int)b!=b)||(b<=1)) { fflush(stdin); printf("error!\n"); } a=(int)b; int
2021-07-25 20:36:20
430
原创 我的第九个链表程序
代码如下:#include <stdio.h>#include <stdlib.h>typedef struct{ char id[500]; char password[500];}Elemtype;typedef struct{ Elemtype data; struct LNode *next;}LNode;LNode ListInsert(LNode *L){ L=(LNode*)malloc(sizeof(LNode)); L->n
2021-07-25 20:04:58
93
原创 带头结点的链表程序
代码如下:#include <stdio.h>#include <stdlib.h>struct LNode{ int a1; int b1; struct LNode *next;};int main(int argc, char *argv[]){ int a[]={1,3,2,4,6,5,7,9,8,0,3,4,5,6}; int b[]={90,56,43,454,54,33,55,44,3,434,432,343,23,43}; struct
2021-07-25 16:38:33
104
原创 C语言实现单链表首尾相连
这是单链表:单链表首尾相连后,形成了循环链表注意:白色方框表示数据域,非白色方框为指针域,非白色方框表示指向的下一个结点的信息的不同代码如下:#include <stdio.h>#include <stdlib.h>typedef struct{ char id[300]; char password[300];}Elemtype;struct LNode{ Elemtype data; struct LNode *next;};i.
2021-07-25 12:16:33
1608
原创 我的第一个循环链表
代码如下:#include <stdio.h>#include <stdlib.h>typedef struct{ char id[300]; char password[300];}Elemtype;struct LNode{ Elemtype data; struct LNode *next;};int main(int argc, char *argv[]){ struct LNode boy; strcpy(boy.data.id,"pas
2021-07-24 21:47:22
67
BBTree 排序树 hpp文件
2023-10-16
在优快云怎么提问非编程问题?比如续写一篇文章,怎么选择标签?
2024-06-18
怎么才能在复杂多变的社会存活下来?
2024-05-20
怎么和随时对自己有威胁的人相处?
2024-05-20
c++ 不在同一子网上的电脑怎么连接?
2024-05-19
怎么和别有用心的人相处?
2024-05-19
整个单位90%以上的人不想正事,整天想着人情世故和勾心斗角,怎么办?
2024-05-19
virtualbox使用了3D加速,为什么还是128MB?
2024-05-18
c++ 怎么实现GPU显存?
2024-05-18
软件开发有什么技术?电子设备操作系统有哪些?c++技术有哪些?
2024-05-18
许多人不想正事,整天想着算计别人,怎么办?
2024-05-18
c++ 怎么才能让程序连接上QQ账号,用指定账号发送或接收信息?
2024-05-18
c++怎么让字符串用自己的QQ号发出去?
2024-05-18
qt vs编程怎么向Linux远程系统编程?
2024-05-18
同样的配置,为什么实体机运行快虚拟机卡死?
2024-05-18
怎么备份Windows系统,然后安装在虚拟机里?
2024-05-17
u盘存在坏道,文件被多次覆盖怎么恢复?
2024-05-17
虚拟机装老系统,怎么才能激活呢?
2024-05-17
c++怎么向所有udp客户端发送信息?实现群聊?
2024-05-17
c++ udp怎么实现广播?
2024-05-17
qt creator 13.0.0怎么连接到Linux?
2024-05-17
电脑反应慢不正常怎么办?
2024-05-17
c++ udp服务器接收到自己的信息怎么办?
2024-05-17
udp服务器为什么会接受到自己的信息?客户端却收不到?
2024-05-17
c++ tcp怎呢广播?
2024-05-17
qt程序怎么加图标?
2024-05-13
多个头文件怎么混入同一个头文件?还不重复?
2024-05-13
多个头文件怎么引用同一个头文件的代码?
2024-05-13
编译时出现:使用了未定义类型“QMetaProperty”
2024-05-10
个性和合群怎么才能平衡?
2024-05-08
应该完成自己的理想,还是陪父母去?
2024-05-06
遇到城府深,心眼坏,反复无常的人怎么办?
2024-05-06
有没有10TB以上内存的电脑?
2024-05-05
Qt,为什么加上Winsock2.h后出现错误?
2024-05-05
qt怎么连接到Linux系统的电脑?
2024-05-05
Qt构建为什么是红色的但是不报错?
2024-05-05
有没有5TB以上内存的电脑?预算50万
2024-05-04
为什么上了这么大内存反而越来越卡了?
2024-05-04
打开自己开发的软件时显示找不到dll文件,怎么才能恢复正常?
2024-04-30
怎么才能正确释放内存,才能不出现错误?
2024-04-29
TA创建的收藏夹 TA关注的收藏夹
TA关注的人