自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 收藏
  • 关注

原创 linux 电子相册

#include <stdio.h>#include <sys/types.h>#include <dirent.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include <sys

2021-07-29 22:01:08 1853 1

原创 020.图,深度优先遍历,迪杰斯特拉算法

main.c#include <stdio.h>#include "graph.h"extern int dist[MAXN];extern char path[MAXN][MAXN];int main(){ struct graph * g = create(); //printfGraph( g); //DFS_S(g); dijkstra(g,1); int i; for(i=0;i<g->n;i++) { if(i != 1)

2021-07-15 20:40:31 200

原创 019. 2021.7.14哈夫曼

main.c#include<stdio.h>#include<stdlib.h>#include"tree.h"#include"linkedList.h"/* 功能:创建一棵哈弗曼树 参数: l 链表头结点 返回值: 返回头结点地址*/Tree * createHuffmanTree(List * l);int main(){ List * l = create();//用来辅助生成哈弗曼树 List * l1 = create();//用

2021-07-14 21:45:42 80

原创 018. 2021.7.13 AVLTree

main.c#include<stdio.h>#include<stdlib.h>#include"AVLTree.h"int main(){ Tree * t = createTree(); TNode * p = NULL; tElemType x; while(1) { scanf("%d",&x); if(x==0) break; p = (TNode *)malloc(sizeof(TNode)); p->dat

2021-07-13 21:43:43 93

原创 017. 2021.7.9 链式队列

main.c#include <stdio.h>#include"queue.h"void main(){ LKQueue *q = initQueue(); int x; enQueue(q,3); enQueue(q,4); enQueue(q,5); enQueue(q,6); getHead(q,&x); printf("%d\n",x); deQueue(q,&x); printf("%d\n",x); deQueue(q,&x)

2021-07-09 21:42:51 56

原创 016. 2021.7.9 顺序队列

main.c#include<stdio.h>#include"queue.h"int main(){ int i = 0; Queue * q = initQueue(); for(i=1;i<=10;i++) { enQueue(q, i); } qElemType x; while(q->n > 0) { deQueue(q,&x); printf("%d ",x); } printf("\n"); en

2021-07-09 21:41:14 67

原创 015. 2021.7.9 链式栈

main.c#include <stdio.h>#include "lkStack.h"void fun(){ char a[]="23+14-5*4+20/5+10-(6+3)"; int i=0; for(i=0;i<24;i++) printf("%c ",a[i]);}void main(){ Stack * s = initStack(); push(s, 1); push(s, 2); push(s, 3); int x; pop(s

2021-07-09 21:39:22 54

原创 0.14 2021-07-09 顺序栈

main.c#include <stdio.h>#include "stack.h"void main(){ Stack * s = initStack(); push(s,1); push(s,2); push(s,3); printf("%d\n",s->stack[0]); printf("%d\n",s->top); int x; pop(s,&x); pop(s,&x); printf("%d\n",s->top); cl

2021-07-09 21:36:28 64

原创 014.2021-07-08(3)

#include<stdio.h>#include <stdlib.h>#include"linkedList.h"List * create(){ List * l = (List *)malloc(sizeof(List)); l->first = NULL; l->last =NULL; l->n = 0; return l;}void headInsert(List * l,ElemType x){ //为新节点

2021-07-08 21:23:56 68

原创 013. 2021-07-08(2)

#include<stdio.h>#include <stdlib.h>#include"linkedList.h"lNode * headInsert(lNode * first,ElemType x){ //为新节点分配空间 lNode * p = (lNode *)malloc(sizeof(lNode)); //lNode node; //为p节点赋值 p->data = x; p->next = NULL; //把新节点插入

2021-07-08 21:22:14 66

原创 012. 2021-07-08

huan.c#include <stdio.h>#include <stdlib.h>#include "huan.h"List * creat(){ List *l = (List *)malloc(sizeof(List)); l->first = l->last = NULL; l->n = 0; return l;}void tailIsert(List *l,Elemtype x){ lNode *p = (lNode

2021-07-08 21:15:05 54

原创 011.带头结点的双向链表

main.c#include "list.h"#include <stdio.h>int main(){ LIST * L = create_list(); insert_node(L,1); insert_node(L,2); insert_node(L,3); insert_node(L,4); printf_list(L); delete_list_x(L,4); printf_list(L);}list.c#include "list.h"#inclu

2021-04-21 20:52:49 114

原创 010.电气测量--粗大误差的计算

#include <stdio.h>#include <stdlib.h>#include <math.h>float ave=0; //平均值float v1,v2;float v4,v3=0,Delta;float* delet_arry(float *num,int* flag) //剔除函数{ //循环求和 float sum=0; //!!!!!!!!!!循环初始化!!!!!!!!! for (int i = 0; i &lt.

2021-04-20 23:31:19 360

原创 009.不带头结点的单链表 创建-打印-寻找-删除-插入使有序

main.c#include <stdio.h>#include <stdlib.h>#include "list.h"int main(){ NODE *p = creat_node(); printf_list(p); free_list(p); printf_list(p); int a = find_node(p,2); if(a == 1) { printf("找到了\n"); } else { printf("没找到\n");

2021-04-20 21:09:30 89

原创 008.求1~100之间的素数

试除法#include <stdio.h>int main(){ int i,j; for(i=1;i<100;i++) { int j = 2; for(j=2;j<i;j++) { if(i%j==0) { break; } } if(i==j) { printf("%d ",i); } } printf("\n");}改进#include <stdio.h>#include &

2021-03-26 23:12:59 69

原创 007.求1000到2000年之间的闰年

1.能被4整除并且不能被100整除2.能被400整除的是闰年#include <stdio.h>int main(){ int year = 0,count = 0; for(year=1000;year<=2000;year++) { if((year%4==0)&&(year%100!=0)||(year%400==0)) { printf("%d \n",year); count++; } } printf("闰年数为

2021-03-26 22:52:15 56

原创 006.求最大公约数

辗转相除法#include <stdio.h>int main(){ int a,b; printf("请输入两个数\n"); scanf("%d%d",&a,&b); int max = 0; if(a<b) { max = b;//确定最大值 b = a; a = max; } while(max%b)//为0跳出循环,直接输出b { max = b;//重新确定最大值 b = max%b;//重新确定最小值 } pri

2021-03-26 22:43:06 72

原创 005.登录界面

要求:用户只能输入3次,超过3次错误退出程序if(password == “123456”) ==不能用来比较两个字符串的大小#include <stdio.h>#include <string.h>int main(){ char password[20] = {0};//用来保存用户输入的密码 int i; for(i=0;i<3;i++) { printf("请输入密码\n"); scanf("%s",password); //if(

2021-03-26 22:27:28 63

原创 004.演示一串字符从两端移动,向中间汇聚

方法:将arr2a中的元素依次替换到arr1中,依次打印#include <stdio.h>#include <string.h>int main(){ char arr1[] = "####################"; char arr2[] = "Welcome to CSDN!!!!!"; int sz = strlen(arr2); //sizeof(arr)/sizeof(arr[0]) 不可行因为字符串后面有"\0" int left =

2021-03-26 22:06:16 67

原创 003.在一个有序数组中查找一个数(直接遍历和二分查找法)

法1:直接遍历#include <stdio.h>int main(){ int arr[] = {1,2,3,4,5,6,7,8,9,10}; int k = 7,i; int sz = sizeof(arr)/sizeof(arr[0]); for(i=0;i<=sz-1;i++)**//直接遍历** { if(arr[i] == k) { printf("找到了,下标是:%d\n",i); break; } } if(i == sz)

2021-03-26 21:37:45 240

原创 002.求1!+2!+3!+4!+5!+6!+7!+8!+9!+10!

//1!+2!+3!+4!+5!+6!+7!+8!+9!+10!#include <stdio.h>int main(){ int i,jiecheng=1; int sum=0;**//不要忘了赋初值** for(i=1;i<=10;i++) { jiecheng=jiecheng*i; sum=sum+jiecheng; } printf("%d\n",sum);}

2021-03-26 21:00:37 200

原创 001.求n的阶乘

#include <stdio.h>int main(){ int ret; int jiecheng=1; printf("请输入一个数:"); scanf("%d",&ret); //由用户输入一个数求阶乘 for(ret;ret>=1;ret--) { jiecheng=jiecheng*ret; } printf("阶乘为: %d\n",jiecheng);}

2021-03-26 20:41:44 55

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除