- 博客(3)
- 收藏
- 关注
原创 2020-12-18
简单计算器实现一个简单计算器,实现两个数的“加减乘除”运算,用户从键盘输入算式“操作数1运算符操作数2”,计算并输出表达式的值,如果输入的运算符号不包括在(+、-、*、/)范围内,输出“Invalid operation!”。当运算符为除法运算,即“/”时。如果操作数2等于0.0,则输出“Wrong!Division by zero!”#include <stdio.h>int main(){ double a,c; char b; while(scanf(
2020-12-18 23:15:37 480 2
原创 2020-12-16
写一个函数返回参数二进制中1的个数以下三种都能实现计算二进制中1的个数#include <stdio.h>int count_bit_one(unsigned int n){ int count = 0; while (n) { if (n % 2 == 1) { count++; } n = n / 2; } return count;}int main(){ int a = 0; scanf("%d", &a);
2020-12-16 21:01:31 100
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人