• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
大佬和我做朋友吧
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 2 3 下一页
2022年1月22日
实现 ./hello 35 - 5 ---->30 ./hello 35 + 5 ----> 40 ./hello 35 / 5 ----> 7 ./hello 5 \* 7 ----> 35
摘要: #include <stdio.h> int main(int argc, char *argv[]) { int a, b; char c; if(argc < 4) { printf("param error like this: ./a.out 35 - 5\n"); return 0; } 阅读全文
posted @ 2022-01-22 15:32 想和大佬做朋友 阅读(43) 评论(0) 推荐(0)
已知数组a[10]和b[10]中元素的值递增有序,用指针实现将两个数组中的元素按递增的顺序输出。
摘要: #include <stdio.h> int main() { int i = 0, j = 0; int a[10] = {1,8,10,12,15,16,17,18,19,40}; int b[10] = {3,9,11,14,25,26,27,28,45,50}; while(i < 10 & 阅读全文
posted @ 2022-01-22 15:31 想和大佬做朋友 阅读(377) 评论(0) 推荐(0)
2022年1月19日
判断数组中是否存在鞍点,在该行最大,在该列最小
摘要: 1 2 6 4 5 6 7 8 9 10 11 12 6是鞍点1) 扫描每一行,找出最大值2) 看这个值是不是 所在列的最小值3) 如果是,输出此数 #include <stdio.h> int main() { int a[3][4] = {{1,2,6,4}, {5,6,7,8}, {9,10, 阅读全文
posted @ 2022-01-19 15:43 想和大佬做朋友 阅读(89) 评论(0) 推荐(0)
输入一个数,判断这个数中有几个1
摘要: 方法1: 1) 对2取余 (如果结果是1,那么说明有一个1)2) 再 / 2, 再执行1, 循环49 % 2 = 1(1) 49 / 2 = 24 24 % 2 = 0(1) 24 / 2 = 1212 % 2 = 0(1) 12 / 2 = 66 % 2 = 0(1) 6 / 2 = 33 % 2 阅读全文
posted @ 2022-01-19 15:35 想和大佬做朋友 阅读(506) 评论(0) 推荐(0)
2022年1月18日
写一个函数,比较三个数,然后求出最大值
摘要: #include <stdio.h> int max(int a, int b, int c) { int d = a > b ? a : b; d = d > c ? d : c; return d; } int main() { int x, y, z; scanf("%d%d%d", &x, 阅读全文
posted @ 2022-01-18 14:04 想和大佬做朋友 阅读(266) 评论(0) 推荐(0)
写一个求一个数的n次方的函数
摘要: 用函数喽 #include <stdio.h> int n_pow(int x, int n) { int i, t = 1; for(i = 0; i < n; i++) { t = t * x; } return t; } int main() { int a = n_pow(2, 3); pr 阅读全文
posted @ 2022-01-18 13:51 想和大佬做朋友 阅读(151) 评论(0) 推荐(0)
判断一个字符串中是否存在某个子串
摘要: // string1 "ftgfdajkfdasklfdsa" // string2 "dajk" #include <stdio.h> #include <string.h> int main() { int i, j; char a[] = "ftgfdajkfdaskdajklfdsa"; c 阅读全文
posted @ 2022-01-18 13:44 想和大佬做朋友 阅读(91) 评论(0) 推荐(0)
2022年1月17日
求两个矩阵之和放在第三个矩阵中 (3行4列)
摘要: int a[3][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}; int b[3][4] = {{1,1,1,1},{2,2,2,2},{3,3,3,3}}; #include <stdio.h> int main() { int a[3][4] = {{1,2,3 阅读全文
posted @ 2022-01-17 20:39 想和大佬做朋友 阅读(88) 评论(0) 推荐(0)
查询一个二维数组当中是否存在某个数,如果存在计算有多少个这样的数
摘要: 1 2 3 45 3 7 89 10 11 12 #include <stdio.h> int main() { int a[3][4] = {{1,2,3,4}, {5,3,7,8}, {9, 10, 11, 12}}; int i, j, n, k = 0; scanf("%d", &n); f 阅读全文
posted @ 2022-01-17 20:35 想和大佬做朋友 阅读(87) 评论(0) 推荐(0)
兔子可能在哪个洞里?
摘要: 围绕着山顶有10个圆形排列的洞,狐狸要吃兔子, 兔子说:“可以,但必须先找到我,我就藏身于这十个洞中的某个洞。 你从1号洞找,下次隔1个洞(即3号洞)找,第三次隔2个洞(即6号洞)找, 再隔3个…以后在这个圆圈中如此类推,次数不限。”但狐狸从早到晚进进出出了1000次,仍没有找到兔子。 问:兔子可能 阅读全文
posted @ 2022-01-17 19:34 想和大佬做朋友 阅读(104) 评论(0) 推荐(0)
上一页 1 2 3 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3