![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言
codesailor
水手
展开
-
模拟数字小时钟
#include int hour,minute,second;void update(){ second++; if (second==60) { second=0; minute++; /* code */ } if (minute==原创 2015-11-07 18:44:59 · 509 阅读 · 0 评论 -
书上的代码总觉得有点问题
#include <stdio.h>#include <stdlib.h>struct link *AppendNopde(struct link *head);void DisplyNode(struct link *head);void DeleteMemory(struct link *head);struct link{ int data ; struct lin转载 2015-11-15 16:19:46 · 295 阅读 · 0 评论 -
栈--最终版
#include <stdio.h>#include <Stdlib.h>typedef struct node{ int data; struct node *pNext;}NODE,*PNODE;typedef struct Stack{ PNODE pTop; PNODE pBottom;}STACK,* PSTACK;void init(PST原创 2015-11-19 21:42:30 · 296 阅读 · 0 评论 -
链式栈
#include <stdio.h>#include <Stdlib.h>typedef struct node{ int data; struct node *pNext;}NODE,*PNODE;typedef struct Stack{ PNODE pTop; PNODE pBottom;}STACK,* PSTACK;void init(PST原创 2015-11-19 17:04:11 · 265 阅读 · 0 评论 -
链栈2
#include <stdio.h>#include <Stdlib.h>typedef struct node{ int data; struct node *pNext;}NODE,*PNODE;typedef struct Stack{ PNODE pTop; PNODE pBottom;}STACK,* PSTACK;void init(PST原创 2015-11-19 17:30:13 · 207 阅读 · 0 评论 -
栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈栈
#include <stdio.h>#include <malloc.h>#include <stdlib.h>typedef struct node{ int * base; int * top; int stacksize;}Sqstack;void InitStack(Sqstack *S){ S->base = (int *)malloc(size原创 2015-12-17 08:30:45 · 2220 阅读 · 0 评论 -
链表222222222222222
#include <stdio.h>#include <malloc.h>typedef struct node{ int data; struct node * next;}Node;int main(){ Node * Head; Node * q; Node * last; Node * delet; Head = (Node*)原创 2015-12-17 08:32:41 · 326 阅读 · 0 评论 -
求二叉树的深度
int Depth(BiTree *T){ int d=0; if (*T) { int ld = Depth(&((*T)->lchild)); int rd = Depth(&((*T)->rchild)); d = ld >= rd ? (ld+1) : (rd+1); } return d;}ld和rd在这原创 2015-12-17 22:42:21 · 208 阅读 · 0 评论 -
删除一棵树
void DestroyBiTree(BiTree *T){ if (*T) { if ((*T)->lchild) DestroyBiTree(&((*T)->lchild)); if ((*T)->rchild) DestroyBiTree(&((*T)->rchild)); free(*T);原创 2015-12-17 21:18:53 · 929 阅读 · 1 评论 -
二叉树二叉树虐我千万遍劳资今天终于搞明白了哈哈哈哈哈
#include <stdio.h>#include <stdlib.h>typedef char TElmType;typedef struct BiNode{ TElmType data; struct BiNode *lchild,*rchild;}BiTNode,*BiTree;void CreateBiTree(BiTree *T){ TElmType原创 2015-12-17 17:26:50 · 458 阅读 · 0 评论 -
二叉树Q
#include <stdio.h>#include <stdlib.h>typedef char TElmType;typedef struct BiNode{ TElmType data; struct BiNode *lchild,*rchild;}BiTNode,*BiTree;void CreateBiTree(BiTree *T){ TElmType c原创 2015-12-17 23:09:28 · 336 阅读 · 0 评论 -
图的建立
#include <stdio.h>#include <stdlib.h>#define MAXVEX 20typedef char VertexType;typedef int EdgeType;typedef struct EdgeNode{ int adjvex; // EdgeType weight;//权值 struct EdgeNode * ne原创 2015-12-19 20:21:58 · 482 阅读 · 0 评论 -
图的建立总结
#include <stdio.h>#include <stdlib.h>#define MAXVEX 20typedef char VertexType;typedef int EdgeType;typedef struct EdgeNode{ int adjvex; // EdgeType weight;//权值 struct EdgeNode * ne原创 2015-12-19 20:51:30 · 409 阅读 · 0 评论 -
单链表的程序实现
#include<stdio.h>//#include<malloc.h>#include<stdlib.h>typedef struct Node{ int data; struct Node * pnext;}NODE, * PNODE;PNODE create_list(){ PNODE phead=(PNODE)malloc(sizeof(NODE));转载 2015-11-16 20:29:20 · 355 阅读 · 0 评论 -
结构体实现模拟时钟
#include <stdio.h>typedef struct clock{ int hour,minute,second;}CLOCK;//函数功能:时分秒时间的更新void Update(CLOCK *t){ t->second++; if (t->second == 60) { t->second=0; t->min转载 2015-11-15 17:16:53 · 2685 阅读 · 1 评论 -
p=p->next
p->next只不过是获取p这个节点的next域只有p=p->next,这种方式才是让p指向了下一个节点q->next=p;p->next=null;q=p;这个里面的q指向的永远是是要在当前节点添加下一个节点的哪个节点假设 q现在指的是1节点,执行q->next=p,就是在1节点后面添加了个节点2 p->next=null,就是把2节点的next域设置为null; q=p 就是把2节点地址给q转载 2015-11-13 01:34:09 · 2193 阅读 · 1 评论 -
两个数的最大公约数
#include <stdio.h>#include <stdlib.h>void Gcd(int a,int b){for (int i = a<b?a:b; i > 0; --i){ if (a%i==0&&b%i==0) { printf("%d\n",i); exit(0); /* code */ } /原创 2015-11-07 20:58:34 · 202 阅读 · 0 评论 -
两个数的最大公约数
聪明的调用了exit()原创 2015-11-07 20:56:44 · 229 阅读 · 0 评论 -
两个数的最大公倍数
C语言原创 2015-11-07 19:11:26 · 448 阅读 · 0 评论 -
小游戏
#include <stdio.h>int magic(int m);int main(){ int m,ret; printf("Input a sum:\n"); scanf("%d",&m); ret = magic(m); if (ret!=1) { printf("Wrong\n"); /*原创 2015-11-07 22:42:27 · 270 阅读 · 0 评论 -
看不懂
#include <stdio.h>int Coconut(int n);int main(){ printf("y = %d\n",Coconut(5));return 0;}int Coconut(int n){int i = 1;float x=1,y;y = n*x+1;do{ y=y*n/(n-1)+1; i++;原创 2015-11-07 22:19:30 · 318 阅读 · 0 评论 -
汉诺塔
#include <stdio.h>void Move(int n,char a,char b){ printf("Move %d : from %c to %c\n",n,a,b);}//函数功能:用递方法将n个圆盘借助于柱子c从源柱子a移动到目标柱子b上void Hanoi(int n,char a,char b,char c){ if(n == 1) {转载 2015-11-07 23:55:42 · 278 阅读 · 0 评论 -
学生成绩小管理
#include <stdio.h>#define STUDENT_N 40#define COURSE_N 3void ReadScore(int score[][COURSE_N],long num[],int n);void AverforStud(int score[][COURSE_N],int sum[],float aver[],int n);void AverforC(int转载 2015-11-08 11:27:21 · 479 阅读 · 0 评论 -
冒泡冒泡冒泡
#include <stdio.h>#define N 10void Bubble(int a[],int n);int main(){ int n,a[N]; printf("Input n:"); scanf("%d",&n); printf("Input %d numbers :\n", n ); for (int i = 0; i < n; +转载 2015-11-08 16:12:46 · 598 阅读 · 0 评论 -
查找算法
#include <stdio.h>#define N 40int ReadScore(int score[],long num[]);int LinSearch(long num[],long x,int n);int main(){ int score[N],n,pos; long num[N],x; n = ReadScore(score,num);原创 2015-11-08 10:23:08 · 342 阅读 · 0 评论 -
选择排序
#include <stdio.h>#define N 40int ReadScore(int score[],long num[]);int FindMax(int score[],int n);void DataSort(int score[],long num[],int n);void PrintScore(int score[],long nnum[],int n);int m原创 2015-11-08 10:24:40 · 217 阅读 · 0 评论 -
无题
#include <stdio.h>#define N 20void Insert(int a[],int n,int x);int main(){ int a[N+1]; int x,i,n; printf("Input array size :"); scanf("%d",&n); printf("Input array:"); for (转载 2015-11-08 15:54:29 · 227 阅读 · 0 评论 -
小学生管理系统V1.0
#include <stdio.h>#define N 30#define M 5void ReadScore(int score[],long num[],int n);int SumC(int score[],int n);void SortByScore(int score[],long num[],int n);void SortByNum(int score[],long nu原创 2015-11-09 08:02:50 · 918 阅读 · 0 评论 -
python3 socket抓包
import socket s=socket.socket(socket.AF_INET,socket.SOCK_RAW,socket.IPPROTO_TCP) while True: print(s.recvfrom(65565))原创 2016-11-07 16:51:44 · 6453 阅读 · 0 评论