
c++
不关我事~
没什么好说的
展开
-
SPN计算周转时间,带权周转时间,平均周转时间,平均带权周转时间
#include <iostream>using namespace std;class JCB{public: void input(); void output(); void bubbleSort(int start, int len); void bubbleSort1(int start, int len); int getCount(int x); void swap(int x, int y); void make原创 2020-06-07 10:49:17 · 1885 阅读 · 0 评论 -
操作系统页面置换算法
#include<stdio.h>int n,nf;int in[100];int p[50];int hit=0;int i,j,k;int pgfaultcnt=0;//页面错误计数void getData(){ printf("\n输入页面数:"); scanf("%d",&n); printf("\n输入frame个数:"); scanf("%d",&nf); printf("\n输入页面序列:");原创 2020-06-07 10:41:01 · 754 阅读 · 0 评论 -
字符串翻转并输出
#include<stdio.h>#include<stdlib.h>#define maxn 1005struct sqlist{ int *p; int length; int size;};sqlist create(){ sqlist l; l.p=(int*)malloc(sizeof(int)*maxn); l.size=maxn; l.length=0; return l;}int inser原创 2020-06-07 10:25:28 · 279 阅读 · 0 评论 -
字符串匹配
#include<bits/stdc++.h>#define ok 1#define error 0#define MAXSIZE 40typedef char sstring[MAXSIZE-1];#define DestoryString clearstringtypedef int Status;using namespace std;Status StrAssign(sstring t,char *chars){ if(strlen(chars)>原创 2020-06-07 10:16:39 · 213 阅读 · 0 评论 -
利用双端队列判断是否是回文串
#include <stdio.h>#include <stdlib.h>#define maxn 1005struct deque{ char *p; int front,rear; int Size,length;};deque Create(){ deque d; d.p=(char*)malloc(sizeof(char)*maxn); d.front=maxn>>1; d.rear=maxn>原创 2020-06-07 10:05:07 · 553 阅读 · 0 评论 -
A,B,C为递增有序链表,删去A中即在B出现也在C出现的元素
#include<stdio.h>#include<stdlib.h>struct list{ int data; list *next;};int main4(){ list *headA,*headB,*headC,*temp,*p; temp=(list*)malloc(sizeof(list)); temp->next=NULL; headA=(list*)malloc(sizeof(list)); headA->next=temp; p=原创 2020-06-07 10:00:29 · 1018 阅读 · 0 评论 -
从一个字符串指定位置取出指定长度的子串
#include<stdio.h>#define maxn 1005typedef char str[maxn+1];void insert(str &s,char *c){ int i=0; char *cc=c; for (;*cc; cc++) { i++; } s[0]=i; for(int j=1;j<=s[0];j++){ s[j]=*(c+j-1); }}void ptr原创 2020-06-07 10:03:57 · 1155 阅读 · 0 评论 -
二叉树的四序遍历
#include<stdio.h>#include<stdlib.h>typedef char elep;#define MAXSIZE 10005struct btree { btree *l,*r; elep data;};struct stack{ btree *base,*top; elep length,Size;};stack create_Stack(){ stack stack1; stack1.base原创 2020-06-07 10:02:39 · 176 阅读 · 0 评论 -
顺序查找算法练习
顺序查找算法练习Time Limit: 1000 MS Memory Limit: 32768 KTotal Submit: 792 (219 users) Total Accepted: 236 (210 users) Special Judge: NoDescription在一个顺序表中查找某个关键字是否存在。Input输入为多组数据,每组为两行数据,每组中第一行为建立查找的顺序表...原创 2019-12-23 21:10:42 · 1214 阅读 · 1 评论 -
线性表顺式模板
#include<stdio.h>#include<iostream>using namespace std;#define MAXSIZE 100#define OK 1#define ERROR 0#define OVERFLOW -2typedef struct { int data[MAXSIZE]; int length;...原创 2019-12-15 13:02:21 · 306 阅读 · 0 评论 -
线性表顺式存储结构及相关操作
#include<stdio.h>#include<stdlib.h>typedef int elep;#define maxn 1005struct sq { elep *p; elep length; elep size;};void insert(sq &l,int x) { l.p[l.length+1]=x;//插入元素 l.len...原创 2019-12-09 16:42:33 · 296 阅读 · 0 评论 -
判断一数位数并逆序输出
#includeusing namespace std;int change(int n) //逆向输出该数{int rn=0;for(int i=0;i<10;i++){if(n>0){rn=rn*10+n%10;n=n/10;}elsebreak;}cout<<rn<<endl;}int weishu(int n) //求该数字...原创 2019-12-09 16:40:38 · 264 阅读 · 0 评论