#include <iostream> #include <string.h> using namespace std; int main() { int tmp; int num = 0; char s[] = "123"; for (int i = 0; i < strlen(s); i++) { tmp = s[i] - '0'; num = num * 10 + tmp; } cout << num; }