五位数分解
include
using namespace std;
int main()
{
//定义变量
int shu1;
int geweishu;
int shiweishu;
int baiweishu;
int qianweishu;
int wanweishu;
//录入数据
cout<<"请输入一个5位整数:";
cin >>shu1;
cout<<endl;
//分解数
geweishu=shu1/1%10;
shiweishu=shu1/10%10;
baiweishu=shu1/100%10;
qianweishu=shu1/1000%10;
wanweishu=shu1/10000%10;
cout<<"万位数是:"<<wanweishu<<endl;
cout<<"千位数是:"<<qianweishu<<endl;
cout<<"百位数是:"<<baiweishu<<endl;
cout<<"十位数是:"<<shiweishu<<endl;
cout<<"个位数是:"<<geweishu<<endl;
}