class Solution public int reverseint x string s=to_stringx;变成字符串 stdreversesbegin send;翻转字符串 int ans=0; try ans=stois;变回数字 if x0 ans=-ans;x是负数加上负号
"exception ex" is used to catch any exception that may occur during the execution of the code inside the try block. In this case, if an exception occurs when converting the reversed string back to an integer using stoi(), the catch block will be executed and the code inside it will be skipped.
原文地址: https://www.cveoy.top/t/topic/iBMN 著作权归作者所有。请勿转载和采集!