日常练习
codesailor
水手
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
看不懂
#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 · 365 阅读 · 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 · 411 阅读 · 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 · 257 阅读 · 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 · 348 阅读 · 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 · 318 阅读 · 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 · 2270 阅读 · 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 · 372 阅读 · 0 评论 -
二叉树二叉树虐我千万遍劳资今天终于搞明白了哈哈哈哈哈
#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 · 499 阅读 · 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 · 248 阅读 · 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 · 1018 阅读 · 1 评论 -
二叉树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 · 375 阅读 · 0 评论 -
图的建立
#include <stdio.h> #include <stdlib.h> #define MAXVEX 20 typedef char VertexType; typedef int EdgeType; typedef struct EdgeNode{ int adjvex; // EdgeType weight;//权值 struct EdgeNode * ne原创 2015-12-19 20:21:58 · 520 阅读 · 0 评论 -
图的建立总结
#include <stdio.h> #include <stdlib.h> #define MAXVEX 20 typedef char VertexType; typedef int EdgeType; typedef struct EdgeNode{ int adjvex; // EdgeType weight;//权值 struct EdgeNode * ne原创 2015-12-19 20:51:30 · 450 阅读 · 0 评论 -
mysql root密码
1、在终端中输入sudo su mysqld_safe --skip-grant-tables --skip-networking &这时便能越过权限表,直接登陆MySQL了。 2、新建一个终端,输入PATH="$PATH":/usr/local/mysql/bin mysql -u root -p。。。卸载mysql命令。。。sudo rm /usr/local/mysql sudo rm原创 2016-03-12 00:32:48 · 296 阅读 · 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 · 2813 阅读 · 1 评论 -
书上的代码总觉得有点问题
#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 · 350 阅读 · 0 评论 -
小学生计算机辅助系统
小学生计算机辅助系统原创 2015-11-07 11:22:00 · 2521 阅读 · 0 评论 -
两个数的最大公约数
#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 · 250 阅读 · 0 评论 -
模拟数字小时钟
#include int hour,minute,second; void update() { second++; if (second==60) { second=0; minute++; /* code */ } if (minute==原创 2015-11-07 18:44:59 · 576 阅读 · 0 评论 -
两个数的最大公约数
聪明的调用了exit()原创 2015-11-07 20:56:44 · 273 阅读 · 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 · 319 阅读 · 0 评论 -
两个数的最大公倍数
C语言原创 2015-11-07 19:11:26 · 497 阅读 · 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 · 318 阅读 · 0 评论 -
无题
#include <stdio.h> #define N 20 void 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 · 273 阅读 · 0 评论 -
查找算法
#include <stdio.h> #define N 40 int 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 · 389 阅读 · 0 评论 -
选择排序
#include <stdio.h> #define N 40 int 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 · 264 阅读 · 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 · 525 阅读 · 0 评论 -
冒泡冒泡冒泡
#include <stdio.h> #define N 10 void 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 · 657 阅读 · 0 评论 -
小学生管理系统V1.0
#include <stdio.h> #define N 30 #define M 5 void 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 · 982 阅读 · 0 评论 -
Hello,World! Python.
2016.10.11 16:33原创 2016-10-11 16:38:16 · 265 阅读 · 0 评论
分享