Bored ~~~ Complete A2C.c

xiaoxiao2021-03-06  42

#include

void main ()

{

Double X, Y;

Char * ch [] = {"zero", "", "", "", "", "Wu", "", "捌", ""}

Char * ch1 [] = {"Picking", "", "仟", "10,000", "", "", "100 million"}

Char num [256];

Long I, N, J, M, Y1;

Printf ("INPUT:");

Scanf ("% lf", & x);

n = (long) x; / * Entoin part * /

Y = x-n; / * Decimal part * /

For (i = 0; n! = 0; i ) / * put an integer part in the array * /

{

NUM [I] = (char) (N% 10);

n / = 10;

}

m = i;

NUM [I] = '.';

/ * The function of this code can be used to get * /

For (Y = Y * 10; ((Y- (long) y) * 10);) / * If the decimal is still there is a number (non-0) loop continues * /

Y * = 10; / * Decimal conversion to integer such as 0.11111 to 11111.00 ... * /

Y1 = (long) y;

For (i = m 1; y1! = 0; i )

{NUM [I] = (char) (Y1% 10);

Y1 = Y1 / 10;} / * put the decimal part into the array * /

/ * End * /

/

For (n = 0; n )

{

IF (NUM [n] == '.') / * n is already filled here * /

{

For (j = n-1; j> = 0; j--) / * Judgment is 10,000 yuan ..

{

IF (m <= 5)

IF (M == 5 && (int) NUM [J] == 0)

;

Else

Printf ("% s", ch [(int) NUM [j]); / * Output uppercase .. * /

Else

IF (M% 4 == 0 && (int) NUM [j] == 0)

;

Else

Printf ("% s", ch [(int) NUM [j]);

IF (m> = 2)

{Printf ("% s", ch1 [m-2]); / * Output picks up .. If there is 2 digits, send it * /

m = m-;

}

Printf ("point");

Break;

}

}

For (i = i-1; NUM [i]! = '.'; I -)

Printf ("% s", CH [(int) NUM [i]]); / * Output decimal part * /

}

转载请注明原文地址:https://www.9cbs.com/read-69613.html

New Post(0)