- 博客(52)
- 资源 (1)
- 收藏
- 关注
原创 C++ 合并链表(编写merge函数尾插法升序合并)
#include<iostream>#include<stdlib.h>using namespace std;#define maxSize 100typedef struct LNode{ int data; struct LNode *next;} LNode;void createlistR(LNode *&C,int ...
2019-10-16 22:29:55
711
原创 C++ 合并线性表(编写merge函数升序合并)
#include<iostream>#include<stdlib.h>using namespace std;#define maxSize 100typedef struct{ int len; int R[maxSize];} list;int merge(list &A,list &B,list &C)...
2019-10-14 22:45:09
949
原创 C++快速排序
#include<iostream>#include<stdlib.h>using namespace std;#define maxSize 100void QuickSort(int R[],int low,int high){ int temp; int i=low,j=high; if(low<high) { ...
2019-10-14 21:34:54
569
原创 C++冒泡排序
#include<iostream>#include<stdlib.h>using namespace std;#define maxSize 100void BubbleSort(int R[],int n){ int i,j; int temp; for(i=n-1; i>=1; --i) { for...
2019-10-10 21:51:22
147
原创 C++直接插入排序(顺带rand()函数的用法)
#include<iostream>#include<stdlib.h>using namespace std;#define maxSize 100void InsertSort(int R[],int n){ int i,j; int temp; for(int i=1; i<n; i++) { te...
2019-10-10 21:26:56
268
原创 C++链队
链队列的建立、入队、出队、判空。#include<iostream>#include<stdlib.h>using namespace std;#define maxSize 100//队结点类型定义typedef struct QNode{ int data; struct QNode *next;} QNode;//链队类型定...
2019-10-09 22:16:03
335
1
原创 C++顺序队
顺序队的建立、入队、出队、判空。#include<iostream>#include<stdlib.h>using namespace std;#define maxSize 100typedef struct{ int data[maxSize]; int front; int rear;} SqQueue;void i...
2019-10-09 21:02:15
250
原创 C++链栈
链栈的建立、插入、弹出、判空。#include<iostream>#include<stdlib.h>using namespace std;#define maxSize 100typedef struct LNode{ int data; struct LNode *next;} LNode;void initStack(LN...
2019-10-08 21:33:36
160
原创 C++顺序栈
简单实现顺序栈的建立、插入、弹出。#include<iostream>#include<stdlib.h>using namespace std;#define maxSize 100typedef struct{ int data[maxSize]; int top;} SqStack;void initStack(SqStac...
2019-10-08 20:34:42
162
原创 C++的char、string类型的数字转换成int类型
1.string类型转成int类型:#include<iostream>#include<string>#include<typeinfo>#include<sstream>using namespace std;int main(){ string text; cin>>text; cout&...
2019-04-23 20:54:43
3531
原创 C++ 两种方法获取int型变量数字的位数
下面写两个方法来实现。第一个方法:用log10#include<iostream>#include<cmath>using namespace std;int main(){ int n; while(1) { cin>>n; int count=1+log10(n); ...
2019-04-23 17:24:24
21187
3
原创 C++ strlen:给char类型数组赋值(不确定长度)并求其长度
想输入一串字符串,可是又不确定要输入多长:char a[1010]; cin>>a; int longa=strlen(a); cout<<longa<<endl;改变某个值:a[1]='a';//要加单引号...
2019-03-23 20:54:41
2212
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅