随笔分类 -  C语言

打印出目录下所有文件名(给出 C、Bash两个版本)
摘要:bash function fl () { if [[ -z "1"]];thenflreaddirPWD elif [[ "1:1"==/]];thenfl{1%/} else fl_read_dir $1 fi } function fl_read_d 阅读全文

posted @ 2023-04-12 22:15 acd407 阅读(33) 评论(0) 推荐(0) 编辑

一个使用Win32api的简单乐谱解析器
摘要:音调数据 enum scale { Rest = 0 , A0 = 21 , A0s = 22 , B0 = 23 , C1 = 24 , C1s = 25 , D1 = 26 , D1s = 27 , E1 = 28 , F1 = 29 , F1s = 30 , G1 = 31 , G1s = 3 阅读全文

posted @ 2023-01-14 11:49 acd407 阅读(35) 评论(0) 推荐(0) 编辑

Mandelbrot Set Visualization
摘要:Bit Draw Solution 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <math.h> 5 #include <complex.h> 6 #include <stdbool.h> 7 阅读全文

posted @ 2022-08-25 23:33 acd407 阅读(17) 评论(0) 推荐(0) 编辑

Color Map
摘要:Source 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <math.h> 5 6 #define XLEN 1024 7 #define YLEN 1024 8 9 int main() 1 阅读全文

posted @ 2022-08-25 10:35 acd407 阅读(10) 评论(0) 推荐(0) 编辑

Logistic Map
摘要:Source Link 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 5 #define X 2560 //尽量为8的倍数,若不是X/8需向上取整 6 #define Y 1600 //推荐X、Y比例为(4.0-2. 阅读全文

posted @ 2022-08-21 12:56 acd407 阅读(86) 评论(0) 推荐(0) 编辑

function plotter
摘要:1 #include <stdio.h> 2 #include <math.h> 3 #include <stdlib.h> 4 #include <stdbool.h> 5 #define max(x, y) ((x)>(y)?(x):(y)) 6 7 #define XDIM 1024 //此项 阅读全文

posted @ 2022-08-17 17:57 acd407 阅读(377) 评论(0) 推荐(0) 编辑

isrepeat
摘要:1 #include <stdbool.h> 2 bool isrepeat(char *source) 3 { 4 long long bits[4] = {0}; 5 int i = 0; 6 while(source[i]){ 7 if(bits[source[i]/64]&(1<<(sour 阅读全文

posted @ 2022-06-22 10:11 acd407 阅读(27) 评论(0) 推荐(0) 编辑

gcc或clang的部分builtin函数
摘要:1 __builtin_ctz(x); // 求x的二进制数末尾0的个数 2 __builtin_ctz(0b0100) //2 3 4 __builtin_clz(x); // 求x的二进制数前导0的个数(ps:一共有32位) 5 __builtin_clz(0b0100) //29 6 7 __ 阅读全文

posted @ 2022-01-21 21:17 acd407 阅读(234) 评论(0) 推荐(0) 编辑

测量代码段运行时间
摘要:需要 time.h struct timespec { time_t tv_sec; // seconds long tv_nsec; // and nanoseconds }; int clock_gettime(clockid_t clk_id,struct timespec *tp); 例子 阅读全文

posted @ 2021-12-25 23:24 acd407 阅读(41) 评论(0) 推荐(0) 编辑

求行列式的值
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 int main(int argc, char **argv) 4 { 5 if(2!=argc) 6 { 7 puts("Arguments Error!"); 8 exit(-1); 9 } 10 FILE 阅读全文

posted @ 2021-10-04 10:21 acd407 阅读(222) 评论(0) 推荐(0) 编辑

万年历
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 int year2day(int y) 5 { 6 if(y%100==0) 7 return (y%400==0)?366:365; 8 else 9 return ( 阅读全文

posted @ 2021-09-29 08:34 acd407 阅读(54) 评论(0) 推荐(0) 编辑

CMD的控制字符输出
摘要:CMD的控制字符输出 1 #include<stdio.h> 2 int main() 3 { 4 int i; 5 for(i=0;i<256;i++) 6 printf("%d:%c\t",i,i); 7 return 0;; 8 } 输出 阅读全文

posted @ 2021-06-18 09:00 acd407 阅读(405) 评论(1) 推荐(0) 编辑

九九乘法表
摘要:C: 1 #include<stdio.h> 2 #include<conio.h> 3 int main() 4 { 5 int i,j; 6 for(i=1;i<=9;i++) 7 { 8 for(j=1;j<=i;j++) 9 { 10 printf("%d*%d=%d\t",j,i,j*i) 阅读全文

posted @ 2021-06-17 21:21 acd407 阅读(43) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示