明解C语言
DiscoYang
立一个码农的FLAG
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
《明解C语言(入门篇)》练习11-10
/*编写函数,实现与库函数atoi、atol、atof相同的功能*/#include <stdio.h>int strtoi(const char *nptr){ int ans = 0; int sign = 1; while (*nptr == ' ') nptr++; if (*nptr == '+') { nptr++; } else if (*nptr == '-') { sign = -1; nptr++; } while (*n原创 2021-02-24 12:13:37 · 274 阅读 · 1 评论 -
《明解C语言(入门篇)》练习7-4
/*编写set函数,返回将无符号整数x的第pos位设为1后的值编写reset函数,返回将无符号整数x的第pos位设为0后的值编写inverse函数,返回将无符号整数x的第pos位取反后的值*/#include <stdio.h>int count_bits(unsigned x){ int bits = 0; while (x) { if (x & 1U) bits++; x >>= 1; }原创 2021-02-16 23:13:06 · 382 阅读 · 0 评论 -
《明解C语言(入门篇)》练习5-9
/*输入学生的分数并纵向显示分布图*/#include <stdio.h>#define NUMBER 80int main(){ int num, max_bunpu; int tensu[NUMBER]; int bunpu[11] = {0}; printf("请输入学生人数:"); do { scanf("%d", &num); if (num < 1 || num >原创 2021-02-16 00:28:47 · 546 阅读 · 2 评论
分享