/
*copyright (c)2014,烟台大学计算机学院
*All rights reserved
*文件名称:qwe.cpp
*作者:孙春红
*完成日期:2014年11月17日
*版本号:v1.0
*
*问题描述:输入一个数,编写程序使程序先输出这个数的个位数,十位数,百位数。。。分离正整数中的各位数。
*/
#include <iostream>
using namespace std;
int main()
{
int a;
while (cin >>a)
{
while (a>0)
{
cout <<a%10<<" ";
a=a/10;
}
}
return 0;
}
运行结果:
知识点总结:
学会并了解多种输入形式的处理。
学习心得:
只要明白除法取余编号写代码了,并且加上循环语句的嵌套。