Home > database >  PB6.5 RMB lowercase capital small problems in your code, in the superior solution
PB6.5 RMB lowercase capital small problems in your code, in the superior solution

Time:09-23

Existence question is: is greater than the amount of more than 100000, capital is converted into a pick up, but asked to pick up a conversion ChengYi, amount to 160000, for example, is the capital of lu wan, need capital into one wan lu,

String hz [15], money [2], val, num2, STR, str_tmp
Int I
Hz [1]='one'
Hz [2]='. '
Hz [3]='3'
Hz [4]='boss'
Hz [5]='wu'
Hz [6]='land'
Hz [7]='pure'
Hz [8]=' '
Hz [9]='nine'
Hz [10]='pick up'
Hz [11]='or'
Hz [12]='$'
Hz [13]='than'
Hz [14]='$'
Hz [15]='$'
Money [1]='Angle'
Money [2]='points'
Val num=
The do while the left (val, 1)='0'
Val=right (val, len (val) - 1)
Loop

If pos (val, '. ') & lt;> 0 then
Num=left (val, pos (val, '. ') - 1)
Num2=mid (val, pos (val, '. ') + 1)
End the if

STR='
For I=1 to len (num)
Str_tmp=mid (num, I, 1)
Choose a case str_tmp
Case '1'
STR=STR + hz [1]
Case '2'
STR=STR + hz [2]
Case '3'
STR=STR + hz [3]
Case '4'
STR=STR + hz [4]
Case '5'
STR=STR + hz [5]
Case '6'
STR=STR + hz [6]
Case '7'
STR=STR + hz [7]
Case '8'
STR=STR + hz [8]
Case '9'
STR=STR + hz [9]
Case '0'
STR=STR + "
The end choose
If str_tmp='0' then
If right (STR, 2)='zero' or STR=' 'or I=len (num) then
STR=STR
The else
STR=STR + 'zero'
End the if
The else
Choose a case len (num) - I + 1
Case 1
STR=STR
Case 2,6,10
STR=STR + hz [10]
Case 3,7,11
STR=STR + hz [11]
Case 4 Sherwin
STR=STR + hz [12]//m
Case 5, 13
STR=STR + hz [13]//'m'
Case 9
STR=STR + '$'
The end choose
End the if
If len (num) - I + 1=9 and mid (num, len (num) - 8, 1)='0' then
If right (STR, 2)='zero' then
STR=left (STR, len (STR) - 2)
STR=STR + '$'
End the if
End the if
If len (num) - I + 1=5 and mid (num, len (num) - 4, 1)='0' then
If right (STR, 2)='zero' then
STR=left (STR, len (STR) - 2)
STR=STR + 'than'
End the if
End the if
Next

If right (STR, 2)='zero' then
STR=left (STR, len (STR) - 2)
End the if
If left (STR, 4)='ten' or left (STR, 4)='one to pick then
STR=right (STR, len (STR) - 2)
Int lpos
Lpos=pos (STR, 'billions')
If lpos & lt;> 0 then
STR=left (STR, the lpos + 1) + mid (STR, the lpos + 4)
End the if
End the if


If pos (val, '. ')=0 then
Return the STR + hz [15]
End the if

STR=STR + hz [15]//point or yuan

Int il_i
Il_i=len (num2)

If il_I & gt; 2 then
Il_i=2
End the if

For I=1 to il_i
Str_tmp=mid (num2, I, 1)
Choose a case str_tmp
Case '1'
STR=STR + hz [1]
Case '2'
STR=STR + hz [2]
Case '3'
STR=STR + hz [3]
Case '4'
STR=STR + hz [4]
Case '5'
STR=STR + hz [5]
Case '6'
STR=STR + hz [6]
Case '7'
STR=STR + hz [7]
Case '8'
STR=STR + hz [8]
Case '9'
STR=STR + hz [9]
Case '0'
STR=STR + 'zero'
The end choose
If right (STR, 2) & lt;> 'zero' then
STR=STR + money [I]
End the if
Next
The do while right (STR, 2)='zero'
STR=left (STR, len (STR) - 2)
Loop
Return the STR

CodePudding user response:

Own before return with 1:
 if the amount of incoming & gt;=100000 and the amount of incoming & lt; Then 200000 
STR='1' + STR
End the if


you can?

CodePudding user response:

reference 1st floor yyoinge response:
himself before the return added:

C/C + + code

If the amount of incoming & gt;=100000 and the amount of incoming & lt; Then 200000
STR='1' + STR
End the if


They can


Ha ha do too much

CodePudding user response:

Learn from yyoinge

CodePudding user response:

  • Related