关于jsonp:剖析整数反序输出

4次阅读

共计 441 个字符,预计需要花费 2 分钟才能阅读完成。

/*#include<iostream>// . 编写一个程序,要求输出一个整数,将各位数字反序后输入。
using namespace std;
int main(){

int x,ox;
int bw,sw,gw;
cout<<"请输出一个整数:"<<endl;
cin>>x;
bw=x%100;                                
sw=x%10;
gw=x%1;
ox=gw*100+sw*10+bw*1;
cout<<"取反后数字为:"<<ox<<endl;
system("pause");
return 0;

}
*/

using namespace std;
int main()
{
int n,right_digit,newnum=0;
cout<<“ 请输出整数值:”<<endl;
cin>>n;
cout<<“ 反序输入数据为:”<<endl;
do
{

  right_digit=n%10;
  newnum=newnum*10+right_digit;
  n/=10;

}while (n);
cout<<newnum<<endl;
system(“PAUSE”);
return 0;
}

正文完
 0