
C语言
llomin
这个作者很懒,什么都没留下…
展开
-
C-指针结构体排序
/*This is a test*/#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>struct Person{ int no, age, height;};typedef struct Person Person;void sort(Person* array, int n){ if (array == NULL || n == NULL) { printf("error"); return; } Pers原创 2020-09-26 18:58:10 · 990 阅读 · 0 评论 -
C-折半查找
/*This is a test*/#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<math.h>void main(){ int n; char c='n'; scanf("%d", &n); int a[100], find,left=0, right=n-1,mid; for (int i = 0; i < n; i++) { scanf("%d,", &a[i]原创 2020-09-26 18:57:37 · 164 阅读 · 0 评论 -
C-对称数查找
#include<stdio.h>#include<math.h>double jc(int a){ double sum=1; if (a == 0) return 1; for (double s=1; s <= a; s++) { sum *= s; } return sum;}int main(){ double n, x,i=0; double sum = 0; scanf("%lf %lf", &x,&n);原创 2020-09-26 18:57:02 · 404 阅读 · 0 评论 -
C-冒泡排序
/*This is a test*/#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<math.h>#include<string.h>void main(){ int num[10], min,temp; scanf("%d %d %d %d %d %d %d %d %d %d", &num[0], &num[1], &num[2], &num[3], &原创 2020-09-26 18:56:18 · 107 阅读 · 0 评论 -
C-镜像数字
/*This is a test*/#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<math.h>int main(){ int num, digit,t; scanf("%d", &num); do { if (num < 0) { num = abs(num); t = 1; } digit = num % 10; printf("%d", digi原创 2020-09-26 18:55:43 · 1080 阅读 · 0 评论 -
C-结构法排序
/*This is a test*/#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>struct Person{ int no, age, height;};typedef struct Person Person;void sort(Person* array, int n){ if (array == NULL || n == NULL) { printf("error"); return; } Pers原创 2020-09-26 18:54:42 · 100 阅读 · 0 评论 -
C-获取系统时间
void main(){time_t t;struct tm *pt ;char *pc ;time(&t);pc=ctime(&t) ; printf("ctime:%s", pc );pt=localtime(&t) ; printf("year=%d", pt->tm_year+1900 );}时间结构体struct tm 说明:struct tm {int tm_sec; /* 秒 – 取值区间为[0,59] */int tm_min; /* 分原创 2020-09-26 18:54:00 · 152 阅读 · 0 评论 -
C-单链表删除指定位置数据
/*This is a test*/#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>typedef struct node{ int d; struct node* next;} node, * ptr;//这里是定义结构与结构便捷生成的连用,*ptr等效为typedef ... *ptr,以后用ptr xx就相当于struct node *xxptr createList(in原创 2020-09-26 18:53:14 · 473 阅读 · 0 评论 -
C-喝酒传花
/*This is a test*/#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<time.h>#include<math.h>struct ren{ int id,times;};typedef struct ren R;int main(){ int n, x, y, z, k = 1, cishu = 1, he=0;原创 2020-09-26 18:52:00 · 120 阅读 · 0 评论