問答題

以下程序的功能是: 將無符號八進制數(shù)字構(gòu)成的字符串轉(zhuǎn)換為十進制整數(shù)。 例如, 輸入的字符串為: 556,則輸出十進制整數(shù) 366。 請寫出正確答案。
#include
main( )
{ char *p,s[6]; int n; p=s; gets(p); n=*p-'0';
while(() != '\0') n=n*8+*p-'0'; printf("%d \n",n); }


您可能感興趣的試卷