C++ 四位数翻转:简单代码实现
#include\x20
int\x20main()\x20{ \x20\x20int\x20n; \x20\x20cin\x20>>\x20n;
\x20\x20int\x20arr[4]; \x20\x20arr[0]\x20=\x20n\x20%\x2010; \x20\x20arr[1]\x20=\x20(n\x20/\x2010)\x20%\x2010; \x20\x20arr[2]\x20=\x20(n\x20/\x20100)\x20%\x2010; \x20\x20arr[3]\x20=\x20n\x20/\x201000;
\x20\x20int\x20reversed\x20=\x20arr[0]\x20*\x201000\x20+\x20arr[1]\x20*\x20100\x20+\x20arr[2]\x20*\x2010\x20+\x20arr[3]; \x20\x20cout\x20<<\x20reversed\x20<<\x20endl;
\x20\x20return\x200; }
原文地址: https://www.cveoy.top/t/topic/pLm6 著作权归作者所有。请勿转载和采集!