随笔分类 -  C语言练习记录

C语言练习记录
摘要:#include<stdio.h> #include<stdlib.h> #define LEN sizeof(struct Student) //用结构体、内存函数,指针,常用数据类型实现一个动态链表 struct Student{ int sno; int name; int gender; s 阅读全文
posted @ 2022-04-16 20:40 帅哥才 阅读(209) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <string.h> #include <ctype.h> int main() { int longest_i(char * p); char str[1000]; gets(str);//输入 int max_i,i; max_i = lo 阅读全文
posted @ 2022-04-11 17:58 帅哥才 阅读(693) 评论(0) 推荐(0)
摘要://求两个数的最大公约数 int a,b,t; scanf("%d%d", &a,&b); //保证a>b int sa = a,sb = b; if(b>a){ t = a; a = b; b = t; } while(a%b){ t = a%b; if(t){ a = b; b = t; } } 阅读全文
posted @ 2022-03-21 17:06 帅哥才 阅读(290) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> /* 一个整数的反置数指的是把该整数的每一位数字的顺序颠倒过来所得到的另一个整数。如果一个整数的末尾是以0结尾,那么在它的反置数当中,这些0就被省略掉了。比如说,1245的反置数54 阅读全文
posted @ 2022-03-20 23:50 帅哥才 阅读(69) 评论(0) 推荐(0)
摘要:#include<stdio.h> int main(){ int i,j,k; //输出十行,ns表示上一行的数据,nx表示当前行的数据,ts表示计算当前行时的临时数据 int ns[11]={0},nx[11]={0},ts[11]={0}; //控制行数:0~9共十行 for (i = 0; 阅读全文
posted @ 2022-03-12 09:54 帅哥才 阅读(47) 评论(0) 推荐(0)