摘要: #include <stdio.h> #define N 80 int count(char* str, char* substr); // 函数声明 int main() { char str[N], substr[N]; int n; gets_s(str); // 输入母串 gets_s(su 阅读全文
posted @ 2021-12-21 21:56 王科锋 阅读(12) 评论(2) 推荐(0) 编辑
摘要: 1次 3次 第一种是找到最大值与最后一项交换,第二种是相邻两项比较,大的放后一项,直到最后一项 #include <stdio.h> #define N 5 int binarySearch(int x[], int n, int item); // 函数声明 int main() { int a[ 阅读全文
posted @ 2021-12-14 16:51 王科锋 阅读(29) 评论(2) 推荐(0) 编辑
摘要: #include<stdio.h> const int N=4; int main() { int a[N]={2,0,2,1}; char b[N]={'2','0','1','1'}; int i; printf("sizeof(int)=%d\n",sizeof(int)); printf(" 阅读全文
posted @ 2021-12-07 21:50 王科锋 阅读(14) 评论(2) 推荐(0) 编辑
摘要: #include <stdio.h> long long fac(int n); // 函数声明 int main() { int i, n; printf("Enter n: "); scanf("%d", &n); for (i = 1; i <= n; ++i) printf("%d! = % 阅读全文
posted @ 2021-11-30 13:00 王科锋 阅读(12) 评论(2) 推荐(0) 编辑
摘要: 2021/11/14 16:21:24 #include<stdio.h> int main() { int num; scanf_s("%d", &num); printf("2049%04d\n", num); scanf_s("%d", &num); printf("2049%04d\n", 阅读全文
posted @ 2021-11-16 12:42 王科锋 阅读(10) 评论(3) 推荐(0) 编辑
摘要: //打印一个字符小人 #include <stdio.h> int main() { printf(" 0 \n"); printf("<H>\n"); printf("I I\n"); printf("\n"); printf(" 0 \n"); printf("<H>\n"); printf(" 阅读全文
posted @ 2021-11-01 17:14 王科锋 阅读(17) 评论(0) 推荐(0) 编辑