为什么这么多错
#include<iostream>using namespace std;
int main()
{
int x,y,z,k,f,e;
int nuber;
cout<<"请输入不大于5位的数字"<<endl;
cin>>nuber;
if(nuber>9999)
e=5;
cout<<"它是5位数"<<endl;
else if(nuber>999)
e=4;
cout<<"它是4位数"<<endl;
else if(nuber>99)
e=3;
cout<<"它是3位数"<<endl;
else if(nuber>9)
e=2;
cout<<"它是2位数"<<endl;
else
e=1;
cout<<"它是1位数"<<endl;
x=(int)(nuber/10000);
y=(int)(nuber-10000*x)/1000;
z=(int)(nuber-10000*x-1000*y)/100;
k=(int)(nuber-10000*x-1000*y-100*z)/10;
f=(int)(nuber-10000*x-1000*y-100*z-10*k);
switch(e)
{
case 5:cout<<x<<y<<z<<k<<f<<endl;
cout<<"反顺序是:"<<f<<k<<z<<y<<x<<endl;
case 4:cout<<y<<z<<k<<f<<endl;
cout<<"反顺序是:"<<f<<k<<z<<y<<endl;
case 3:cout<<z<<k<<f<<endl;
cout<<"反顺序是:"<<f<<k<<z<<endl;
case 2:cout<<k<<f<<endl;
cout<<"反顺序是:"<<f<<k<<endl;
case 1:cout<<k<<f<<endl;
cout<<"反顺序是:"<<f<<endl;
}
return 0;
}
先求出是几位数,然后是相反显示出来。
谢谢!!