题解 1009: [编程入门]数字的处理与判断

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

最无脑解法:if

摘要:解题思路:题目要求五位数,还好不算多,直接无脑if判断a>0 and a<10就能确定为一位数,以此类推,再通过除法及取模抽取位数。参考代码:#include <stdio.h> int main(……

初学者用if暴力解法

摘要:解题思路:定义一个变量a,其中:if条件a/10000!=0表示a为一个五位数,以此类推注意事项:注意else if 的用法,不要丢了else 第二个问题不要用else参考代码:#include <s……

C++利用指针重复遍历输出

摘要:解题思路:注意事项:参考代码:#include<iostream>#include<string.h>using namespace std;int main(){    char str[20] =……

递归函数法

摘要:解题思路:注意事项:参考代码:#include <stdio.h>#include <math.h>int b[5],i=0,mask2=1,n=0;int fun(int a ,int w){ if……

求最大公约数和最小公倍数

摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){    int m, n,min=1,max=1,i;    cin >……

C++速度功成

摘要:解题思路:将输入的数字串当作数组,利用库函数string,直接获得数组长度,然后for循环遍历数组每一个位置上的数字,输出;法二:构建一空数组,利用for循环将输入的数字串逐个拆解,从个位数依次填入数……

C语言 注意范围

摘要:解题思路:注意事项:参考代码:#include <stdio.h>  //头文件#include <string.h>int main() //一个文件的开头{ char n[6]; gets(n);……