今天把开课为止,所有的作业做了一遍
1 #include <stdio.h> 2 3 4 int my_strlen(char *str); 5 char *my_strcpy(char *dest, char *src); 6 char *my_strncpy(char *dest, char *src, int n); 7 char *reverse(char *str); 8 void bubble_sort(int *str, int n); 9 int fibe_frac(int n); 10 void fibe_iteration(int n); 11 int *fibswap(int *a, int *b, int *c); 12 int bin_search(int *array,int start, int stop, int target); 13 int bin_search_recursion(int *array,int start, int stop, int target); 14 int fractorial_iteration(int n); 15 int fractorial(int n); 16 17 void test_sort(); 18 void test_strlen(); 19 void test_my_strcpy(); 20 21 int input_num(); 22 void print_string(char *str); 23 void printf_array(int *a, int n); 24 25 26 int main() 27 { 28 int i = 0; 29 int n = 0; 30 test_strlen(); 31 test_my_strcpy(); 32 test_sort(); 33 n = input_num(); 34 for (i = 0; i < n; ++i) 35 { 36 printf("%d ",fibe_frac(i)); 37 } 38 printf(" "); 39 40 printf("The fractorial is %d. ",fractorial_iteration(input_num())); 41 42 return 0; 43 } 44 45 /* 46 ***************************************************************** 47 */ 48 49 50 /* 51 * calculate the length of the string 52 */ 53 int my_strlen(char *str) 54 { 55 int len = 0; 56 57 while(*str != '