C ++でのatoi()関数とstoi()関数の使用法と違い



Usage Difference Atoi



#include #include using namespace std int main() { string s1 = '2147482', s2 = '-214748' string s3 = '214748666666663', s4 = '-21474836488' cout << stoi(s1) << endl cout << stoi(s2) << endl cout << atoi(s3.c_str()) << endl cout << atoi(s4.c_str()) << endl system('pause') return 0 }

コンソール:

参照: https://blog.csdn.net/qq_33221533/article/details/82119031