128.#include<iostream>
129.using namespace std;
130.int main()
131.{long int i;
132.int a,b,c,d,e,f;
133.cout<<"输入一个五位数:";
134.cin>>i;
135.if(i>9999)
136.f=5;
137.else if(i>999)
138.f=4;
139.else if(i>99)
140.f=3;
141.else if(i>9)
142.f=2;
143.else
144.f=1;
145.cout<<"位数为:"<<f<<endl;
146.e=i/10000;
147.d=(i-e*10000)/1000;
148.c=(i-e*10000-d*1000)/100;
149.b=(i-e*10000-d*1000-c*100)/10;
150.a=(i-e*10000-d*1000-c*100)%10;
151.switch(f)
152.{case 5:cout<<e<<","<<d<<","<<c<<","<<b<<","<<a<<endl;
153.cout<"倒序:"<<a<<b<<c<<d<<e<<endl;break;
154.case 4:cout<<d<<","<<c<<","<<b<<","<<a<<endl;
155.cout<<"倒序:"<<a<<b<<c<<d<<endl;break;
156.case 3:cout<<c<<","<<b<<","<<a<<endl;
157.cout<<"倒序:"<<a<<b<<c<<endl;break;
158.case 2:cout<<b<<","<<a<<endl;
159.cout<<"倒序:"<<a<<b<<endl;break;
160.case 1:cout<<a<<endl;
161.cout<<"倒序:"<<a<<endl;break;
162.}
163.return 0;
164.}
129.using namespace std;
130.int main()
131.{long int i;
132.int a,b,c,d,e,f;
133.cout<<"输入一个五位数:";
134.cin>>i;
135.if(i>9999)
136.f=5;
137.else if(i>999)
138.f=4;
139.else if(i>99)
140.f=3;
141.else if(i>9)
142.f=2;
143.else
144.f=1;
145.cout<<"位数为:"<<f<<endl;
146.e=i/10000;
147.d=(i-e*10000)/1000;
148.c=(i-e*10000-d*1000)/100;
149.b=(i-e*10000-d*1000-c*100)/10;
150.a=(i-e*10000-d*1000-c*100)%10;
151.switch(f)
152.{case 5:cout<<e<<","<<d<<","<<c<<","<<b<<","<<a<<endl;
153.cout<"倒序:"<<a<<b<<c<<d<<e<<endl;break;
154.case 4:cout<<d<<","<<c<<","<<b<<","<<a<<endl;
155.cout<<"倒序:"<<a<<b<<c<<d<<endl;break;
156.case 3:cout<<c<<","<<b<<","<<a<<endl;
157.cout<<"倒序:"<<a<<b<<c<<endl;break;
158.case 2:cout<<b<<","<<a<<endl;
159.cout<<"倒序:"<<a<<b<<endl;break;
160.case 1:cout<<a<<endl;
161.cout<<"倒序:"<<a<<endl;break;
162.}
163.return 0;
164.}