摘要: include<stdio.h> int main() { int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; printf("%d\n",&arr[9] - &arr[0]);//中间数组的个数 return 0; } strlen求字符串的长度'/0 阅读全文
posted @ 2024-01-20 21:27 累die 阅读(3) 评论(0) 推荐(0) 编辑
摘要: include<stdio.h> //实现函数初始化数组为全0 void Init(int arr[],int sz) { int i = 0; for (i = 0; i < sz; i++) { arr[i] = 0; } } //打印数组的每个元素 void Print(int arr[], 阅读全文
posted @ 2024-01-19 10:00 累die 阅读(6) 评论(0) 推荐(0) 编辑
摘要: //game.h define ROW 3 define COL 3 include<stdio.h> void InitBoard(char board[ROW][COL], int row, int col); void DisplayBoard(char board[ROW][COL], in 阅读全文
posted @ 2024-01-15 17:30 累die 阅读(3) 评论(1) 推荐(0) 编辑
摘要: define _CRT_SECUNRE_NO_WARNINGS 1//更改newc++file达到一劳永逸 pragma warning(disable:4996)//屏蔽:4996的错误 include<stdio.h> int main() { int a = 0; scanf("%d", &a 阅读全文
posted @ 2024-01-15 09:42 累die 阅读(17) 评论(0) 推荐(0) 编辑
摘要: define _CRT_SECUNRE_NO_WARNINGS 1 include<stdio.h> void bubble_sort(int arr[], int sz) { int i = 0; for (i = 0; i < sz; i++)//冒泡的次数 { int flag = 1;//假 阅读全文
posted @ 2024-01-14 21:49 累die 阅读(4) 评论(0) 推荐(0) 编辑
摘要: int fac1(int n) { int i=0; int ret=1; for(i=1;i<=n;i++) { ret=i; } return ret; } //递归与迭代 int fac2(int n) { int i=0; { if(n<=0) return 1; else return n 阅读全文
posted @ 2024-01-14 11:31 累die 阅读(21) 评论(0) 推荐(0) 编辑
摘要: include<stdio.h> //int my_strlen(char* str) //{ // int count=0; // while(str != '\0') // { // count++; // str++; // } // return count; // } // 递归方法 in 阅读全文
posted @ 2024-01-12 20:32 累die 阅读(2) 评论(0) 推荐(0) 编辑
摘要: include<stdio.h> //int is_prime(int n) //{ //int m; //for(m=2;m<n;m++) //{ // if(n%m0) //return 0; //} //return 1; //} //int main() //{ // int i=0; // 阅读全文
posted @ 2024-01-12 09:12 累die 阅读(3) 评论(0) 推荐(0) 编辑
摘要: include<stdio.h> //void swap(int x,int y) //{ //int tmp=0; //tmp=x; //x=y; //y=tmp; //} void swap2(int *pa,int pb) { int tmp=0; tmp=pa; pa=pb; *pb=tmp 阅读全文
posted @ 2024-01-11 11:36 累die 阅读(1) 评论(0) 推荐(0) 编辑
摘要: include<stdio.h> include<string.h> include<math.h> int main() //输出1-100以内的素数(试除法) //{ //int a; //int count=0; //for(a=100;a<=200;a++) //{ // int j; // 阅读全文
posted @ 2024-01-11 10:24 累die 阅读(4) 评论(0) 推荐(0) 编辑