問題是八進制轉十進制
int main(void) {
unsigned int c, num = 0, ct = 0;
printf("Please input a positive octal integer and end with pressing Enter:\n");
// Read the octal string, at most 10 characters.
while ((c = getchar()) != '\n' && ...) {
...
}
// If the input is not valid, output the error message.
if (c != '\n') {
printf("ERROR: the input should be an octal string containing 0-7, with length less than 11!\n");
} else { // Output the conversion table.
printf("i\t8^i\tdigit\tproduct\n");
...
// Output the decimal value
printf("Decimal value: %d\n", num);
}
return 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/159453.html
標籤:C語言
上一篇:c++ vector容器例外求助
下一篇:XML--決議
