C++做一个降序数的判断,遇到了电问题
#include<iostream.h>voidmain(){intx,t;intsign=0;cout<<"number"<<endl;cin>>x;doif(x%10...
#include<iostream.h>
void main()
{int x,t;
int sign=0;
cout<<"number"<<endl;
cin>>x;
do
if(x%10>=t)
{t=x%10;
x/=10;}
else
{sign=1;
break;}
while(x%10==0);
if(sign==1)
cout<<"No"<<endl;
else
cout<<"YES"<<endl;
}
以上就是代码
sign等于是一个判断的数值,X是想要判断的数
t初始为0跟x&
#include<iostream.h>
void main()
{int x,t;
int sign=0;
cout<<"number"<<endl;
cin>>x;
do
if(x%10>=t)
{t=x%10;
x/=10;}
else
{sign=1;
break;}
while(x%10==0);
if(sign==1)
cout<<"No"<<endl;
else
cout<<"YES"<<endl;
} 展开
void main()
{int x,t;
int sign=0;
cout<<"number"<<endl;
cin>>x;
do
if(x%10>=t)
{t=x%10;
x/=10;}
else
{sign=1;
break;}
while(x%10==0);
if(sign==1)
cout<<"No"<<endl;
else
cout<<"YES"<<endl;
}
以上就是代码
sign等于是一个判断的数值,X是想要判断的数
t初始为0跟x&
#include<iostream.h>
void main()
{int x,t;
int sign=0;
cout<<"number"<<endl;
cin>>x;
do
if(x%10>=t)
{t=x%10;
x/=10;}
else
{sign=1;
break;}
while(x%10==0);
if(sign==1)
cout<<"No"<<endl;
else
cout<<"YES"<<endl;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询