c语言学习
从天边飞来
现中科大学生一枚
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【算法图解】T4.1 用递归做加法
#include <stdio.h>int add(int array[],int num){ int ret = 0; if (num==0){ ret = 0; } else if(num==1){ ret = array[0]; printf("函数仅剩最后一个值%d\n",ret); } else{ num=num-1; printf("num=%d ",num);原创 2021-09-02 22:27:14 · 249 阅读 · 0 评论 -
【Mooc笔记】选择排序
选择排序Select_sort#include <stdio.h>//When the array is not sorted, it's a way to sort it, though not quick enough.//Sort descending for example, choose the biggest one and move it to the first place, using swap. Then move the second biggest one to原创 2021-08-16 15:32:41 · 138 阅读 · 0 评论 -
【Mooc笔记】数组操作(找出100以内的素数)
数组操作(找出100以内的素数)方法一:#include <stdio.h>//find out all the prime numbers smaller than NUMBERS//solution1: Traverse all the numbers, eliminating composite numbers one by one.int check_is_prime(int test_number, int prime_list[], int count_of_curren原创 2021-08-16 15:10:09 · 808 阅读 · 0 评论 -
【Mooc笔记】二分查找(美国的各种硬币名称)
二分查找(美国的各种硬币名称)#include <stdio.h>struct { int amount; char *name;}coins[]={ {1,"penny"}, {5,"nickel"}, {10,"dime"}, {25,"quater"}, {50,"half-dollar"}, };//binary search can be used only un原创 2021-08-16 14:28:29 · 126 阅读 · 0 评论
分享