#include<iostream> using namespace std; int main() { int shu1,shu2; cin>>shu1; for (int a=shu1;a!=0;a/10) { shu2=shu2*10+a%10; a/=10; } cout<<shu2; return 0; }
之前没加上
a/=10(第十一行)
然后超时了,求for用法和while 谢