- 博客(15)
- 收藏
- 关注
原创 【学习报告】《LeetCode零基础指南》(第一讲)函数
一、今日知识点总结: 掌握Leetcode提交方法 掌握C++函数基本结构二、今日做题记录:1. 两整数之和int getSum(int a, int b){ return a + b;}2. 不用加号的加法int add(int a, int b){ return a + b;}3. 不用加减乘除做加法int add(int a, int b){ return a + b;}4. 递归乘法int multiply(int A, int
2022-04-03 23:58:55
458
原创 《明解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
232
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
345
原创 《明解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
517
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人