Capital transfer problem

xiaoxiao2021-03-06  112

Find a big write amount on the Internet, add such an error after adding to your own program: The capital amount converted is always big, I don't know where it is, please give a look.

Operating environment WIN2003, VB.NET

The code is as follows: TB_X and TB_H are TEXTBOX components,

?

DIM A = TB_X.TEXT 'To convert the amount of uppercase ??????? DIM ATOC' conversion value ??????? DIM STRING1 'is defined below ??????? Dim string2' Define ??????? DIM STRING3 'Take it from the original a value ?????? DIM I' cycle variable ??????? DIM J 'A multiply by 100 string Length ??????? DIM CH1 'Chinese reading ??????? DIM CH2' digital bit reading ?????? Dim Nzero 'used to calculate the continuous zero value is several

??????? String1 = "Zero 壹 贰 伍 柒捌 柒捌" ??????? String2 = "Wan Rong picks up billion 佰 佰 万 万 佰 元" ??? ???? nzero = 0

??????? IF INSTR (1, CSTR (A * 100), ".") <> 0 THEN ?????????? Err.raise (5000, "this function (ATOC ()) There is only two numbers within two digits after converting the decimal point! ") ??????? endiff

??????? j = le (CSTR (A * 100)) ??????? String2 = Right (string2, j) 'Take out the value of String2 of the corresponding bit /// This line is debugging Tip error

??????? for i = 1 to j ??????????? String3 = MID (A * 100, i, 1) 'Removes the value of a bit that needs to be converted

??????????? IF i <> (j - 3) 1 and i <> (j - 7) 1 and i <> (j - 11) 1 and i <> (j - 15) 1 THEN ????????????????i string3 = 0 THEN ??????????????????? CH1 = ""? ???????????????????????????????????????????? Nzero = NZERO 1 ???? ??????????? Elseif string3 <> 0 and nzero <> 0 THEN ??????????????????? CH1 = "zero" & MID (String1 , Clng (string3) 1, 1) ???????????????????? CH2 = MID (String2, I, 1) ??????????? ???????? nzero = 0 ???????????????? ELSE ??????????????????? CH1 = MID ( String1, clng (string3) 1, 1) ??????????????????? CH2 = MID (String2, I, 1) ?????????? ????????? nzero = 0 ??????????????????????????????????????????????????????????. Wan, Yuanzhang and other key positions ???????????????? f string3 <> 0 and Nzero <> 0 THEN ???????????????????????????? ?? chain = "zero" & mid (string1, clng (string3) 1, 1) ??????????????????? CH2 = MID (String2, I, 1) ???????????????????? Nzero = 0 ??????????????? Elseif string3 <> 0 and Nzero = 0 THEN??? ????????????????? CH1 = MID (String1, ClNG (String3) 1, 1) ????????????????? CH2 = MID (String2, I, 1) ???????????????????? Nzero = 0 ???????????????? Elseif string3 = 0 and Nzero> = 3 THEN ??????????????????? CH1 = " "????????????????????????????????????????????? Nzero = NZERO 1 ?? ????????????????????????????????????????????? ?????? CH2 = MID (String2, I, 1) ??????????????????? Nzero = NZERO 1 ?????????? ????? End IF

??????????????? IF i = (j - 11) 1 or i = (j - 3) 1 Then 'If the bit is a billion or a ballad, you must write ??????????????????????????????????????????????????????????? End IF???? ???????? end if ??????????? atoc = ATOC & CH1 & CH2

??????????? IF i = j and string3 = 0 Then 'the last one (minute) is 0, plus "whole" ?????????????? ? atoc = atoc & "whole" ??????????? Endiff

??????? next ??????? if a = 0 THEN ??????????? ATOC = "Zero Yuan" ??????? end if ??? ???? tb_h.text = atoc ??? End Sub

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

New Post(0)