- 博客(14)
- 收藏
- 关注
原创 C语言:链表建立 头插法 尾插法
#include#includestruct list{ int data; struct list *next;};int i;void output(struct list *head);void creat(struct list *head, int n)//头插法{ struct list *p, *q; head->next=NULL; p=head;
2014-11-11 17:33:38
12288
3
原创 C语言:十字链表的相加相减
#include#include#define N 100typedef struct node{ int row, col; int v; struct node *r, *d;}*link;typedef struct crosslist{ link rowhead[N], colhead[N]; int rows, cols, nums;}*list;int
2014-11-11 17:29:47
1789
2
原创 C语言:哈夫曼树的编码与译码
#include#include#include#include#define N 100typedef struct { int weight; int parent, lchild, rchild;}hafuman;typedef struct { char data[N]; //字符数据 char copy[N][10*N];//编码}bianma;v
2014-11-11 17:24:53
8215
1
原创 C语言:马踏棋盘,改编自《数据结构与算法》.
#include#include#define stack_size 100#define n 8int a[n][n];int sort[n][n][8];int i, j, k,h,l;struct seat{ int x, y;//坐标 int direct;};struct stack{ struct seat *top, *base;};struct
2014-10-02 19:58:24
2206
原创 C语言:贪吃蛇,用指针数组和字符型数组编写。
#include#include#include #include#include#include//_kbhit()#define N 21 int i, j;int level=1;void set(char stage[][2*N]);void show(char stage[][2*N], int level);char direct(char **length,
2014-08-18 22:44:15
1035
原创 C语言:大数相乘.
#include#include#define N 200void cheng(char a[], int n, char b[], int m){ int s[N] = {0}, i=N-1, p=0; int l, j; for( ; n>=0; n--) { for(j=i, l=m; l>=0; j--, l--) { s[j] = s[
2014-07-19 22:22:04
699
原创 C语言:大数相加与大数相减.
#include#include#define N 100int res[N] = {0};char *add(char a[], int n, char b[], int m) //大数相加{ int i=N-1, z=0, j; for( ; n>=0; n--, m--) { if(m>=0) res[i] = res[i] + a[n]-'0'
2014-07-19 22:19:41
5341
1
原创 C语言:实现大数相除,利用大数相减原理。
#include#includechar a[100], b[100];int res[100]={0};int l1, l2, n, m;void sub(){ int i, z=0; n = l1; //a的长度可能会变化 m = l2; //m在执行sub()时会m--; for( ; n>=0; n--, m--) { if(m
2014-06-25 20:14:24
1084
原创 密码输入,用***代替,可删除***,验证码的随机生成,包括大写字母,小写字母,数字.
#include#include#include#include#includechar *password(){ char a[10], i; for(i=0; ; ) { a[i] = getch(); if(a[i] == 8) { printf("\b \b"); i--; } else if(a
2014-05-30 18:04:11
995
原创 C语言:链表的循环,两种思考方法,第一种用select_1()实现,第二种用select_2()实现.
#include #include #includestruct s{ int n; struct s *next;};int i;struct s *head, *tail;void creat(m){ struct s *p, *p1; head = NULL; for(i=0; i<m; i++) { p = (struct
2014-05-27 22:12:41
576
原创 1.删除字符串中重复的字符 2.删除字符串中指定的字符串 3.删除数组中重复元素
#include#includevoid del_1(char s[]) //删除重复字符{ int i, j, k; for(i=0; s[i] != '\0'; i++) for(j=i+1; s[j] != '\0'; ) if(s[i] == s[j]) { for(k=j; s[k] != '\0'; k++) s[k] =
2014-05-27 22:03:31
2146
原创 C语言:链表的逆序,两种思考方法,第一种用rev_1()实现,第二种用rev_2( )实现.
#include #include struct s{ int n; struct s *next;};int i;struct s *creat(int m){ struct s *head, *p, *p1; head = NULL; for(i=0; i<m; i++) { p = (struct s*)malloc(sizeof(
2014-05-26 14:22:00
991
原创 C语言:动态链表的建立,查找,删除,插入功能的实现
#include#includestruct student{ int num; float score; struct student *next;};int i, n;struct student *creat(){ struct student *head, *p1, *p2; p1=p2=(struct stude
2014-05-25 19:09:04
2777
原创 静态链表.
#includestruct s{ char name[20]; int num; struct s *next;};int i;struct s *creat(int n){ struct s a[100]; struct s *head; for(i=0; i<n; i++) { print
2014-05-25 19:02:49
496
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人