#include <iostream> using namespace std; int main(){ //八进制转十进制 char *p,s[6]; int n; p=s;//初始化字符串指针 cin>>p; n=0; while (*(p)!='\0') { n=n*8+*p-'0';//*p是字符,所以要减去'0',即减去48 p++; } cout<<n<<endl; return 0; }