The Title Description converts the decimal number to octal and outputs the result. Figure: converts the decimal number to octal and outputs the input format. The input contains several decimal positive integers. Output the corresponding Octal numbers, each of which occupies one row. Sample input 1237891910020345 sample output 123710112346162771
# Include <string. h> # include <ctype. h> # include <malloc. h>/* malloc () and so on */# include <limits. h>/* INT_MAX, etc. */# include <stdio. h>/* EOF (= ^ Z or F6), NULL */# include <stdlib. h>/* atoi () */# include <math. h>/* floor (), ceil (), abs () * // * function Result Status Code */# define TRUE 1 # define FALSE 0 # define OK 1 # define ERROR 0 # define INFEASIBLE-1 typedef int Status; /* Status indicates the function type, and its value is the function result Status code, such as OK */typedef int Boolean;/* Boolean indicates a Boolean value. TRUE or FALSE */# define STACK_INIT_SIZE 10/* Initial bucket allocation */# define STACKINCREMENT 2/* bucket allocation increment */typedef int SElemType; /* define the stack element type as integer */typedef struct SqStack {SElemType * base;/* The base value is NULL */SElemType * top before and after stack construction; /* stack top pointer */int stacksize;/* currently allocated storage space, in the unit of elements */} SqStack; /* sequential stack */Status InitStack (SqStack * S) {/* construct an empty stack S */(* S ). base = (SElemType *) malloc (STACK_INIT_SIZE * sizeof (SElemType )); If (! (* S ). base) exit (OVERFLOW);/* storage allocation failed */(* S ). top = (* S ). base; (* S ). stacksize = STACK_INIT_SIZE; return OK;} Status Push (SqStack * S, SElemType e) {/* insert element e as the new stack top element */if (* S ). top-(* S ). base> = (* S ). stacksize)/* Full stack, append storage space */{(* S ). base = (SElemType *) realloc (* S ). base, (* S ). stacksize + STACKINCREMENT) * sizeof (SElemType); if (! (* S ). base) exit (OVERFLOW);/* storage allocation failed */(* S ). top = (* S ). base + (* S ). stacksize; (* S ). stacksize + = STACKINCREMENT;} * (* S ). top) ++ = e; return OK;} Status Pop (SqStack * S, SElemType * e) {/* If the stack is not empty, the top element of S is deleted, return the value with e and OK; otherwise, ERROR */if (* S) is returned ). top = (* S ). base) return ERROR; * e = * -- (* S ). top; return OK;} Status StackEmpty (SqStack S) {/* if Stack S is empty, TRUE is returned; otherwise, FALSE */if (S. top = S. base) return TRUE; else return FALSE;} void co Nversion (int n)/* algorithm 3.1 */{/* for any non-negative decimal integer input, print the number of octal equal to the value */SqStack s; SElemType e; initStack (& s);/* initialize stack */while (n)/* WHEN n is not equal to 0 */{Push (& s, n % 8 ); /* the remainder of n divided by 8 (the low position in octal) */n = n/8;} while (! StackEmpty (s)/* When the stack is not empty */{Pop (& s, & e ); /* the top element of the stack is displayed and assigned to e */printf ("% d", e);/* Output e */} printf ("\ n ");} int main () {int n; while (~ Scanf ("% d", & n) {conversion (n);} return 0 ;}