- 博客(6)
- 收藏
- 关注
原创 C++递归算法实现二叉树的前、中、后序遍历
#include<iostream> #define OK 1#define ERROR 0#define OVERFLOW -1typedef int Status;typedef char ElemType;using namespace std;typedef struct BiTNode{ ElemType data; struct BiTNode *lchild,*rchild;}BiTNode,*BiTree;//前序遍历建立二叉树 Status Cre.
2022-05-29 16:52:03 185 1
原创 C++,简单循环队列的实现
#include<iostream>#define MAXQSIZE 100#define OK 1#define ERROR 0#define OVERFLOW -1typedef int QElemType;typedef int Status;using namespace std;typedef struct{ QElemType *base; int front; int rear;}SqQueue;//循环队列的初始化 Status InitQueu.
2022-05-22 21:55:20 211 1
原创 C++,简单的顺序栈
#include<iostream>#define MAXSIZE 100#define OK 1#define ERROR 0#define OVERFLOW -2using namespace std;typedef int ElemType;typedef int Status;//定义栈typedef struct{ ElemType * base; ElemType * top; int stackSize;}sqStack;//栈的初始化Statu.
2022-05-09 19:16:30 204 2
原创 C++,一个简单的顺序表
#include<iostream> #define MAXSIZE 100#define OK 1#define ERROR 0#define OVERFLOW -2using namespace std;typedef int Status;typedef int ElemType;//定义顺序表typedef struct{ int *elem; int length;}SqList;//初始化顺序表Status InitList(SqList &.
2022-04-23 19:48:00 1220 1
原创 用C语言实现输入某年某月某天,求这个日期在该年的第几天
代码如下:#include<stdio.h>int main(){ int total; int year,leap,day,i,mon; int m=0; int mon_1[12]={31,29,31,30,31,30,31,31,30,31,30,31}; int mon_2[12]={31,28,31,30,31,30,31,31,30,31,30,31}; printf("Please input year:\n"); scanf("%d",&year)
2021-11-29 22:05:08 1349
原创 任意输入n位整数从小到大排序输出(动态数组指针结合实现)
来自一个c语言初学者突发奇想解决的一个困惑蛮久的简单问题代码如下:#include<stdio.h>#include<stdlib.h>void sort(int * a,int L);int main(){ int len; int i; int * pArr; printf("Please input the array length:\n"); scanf("%d",&len); pArr=(int *)malloc(s...
2021-11-27 15:13:45 1594 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人