• Articles
  • How I Used My C++ Programming Technique
Published by
Jun 24, 2012 (last update: Jun 14, 2014)

How I Used My C++ Programming Technique To Convert A Numerical Amount To A Verbal Amount

Score: 2.9/5 (196 votes)
*****
INTRODUCTION

I would like to discuss a programming technique I developed in C++ several years ago for converting a numerical amount to a verbal amount. I use this in a check book register program I made for a longtime customer in my hometown of Cleveland, Ohio USA. This technique is part of a module in a larger program that is used to compose and issue checks every week for payroll, taxes, shop materials, office supplies, utilities and more. It has proven to be very reliable over a period of years. This algorithm can also be implemented for assistance with printing legal contracts, loan documents, promissory notes and many more things where a verbal amount needs to be specified.




The full C++ program code readout for this can be viewed on my website. Next, I will explain the logic flow so it can be easily understood.

GETTING SET UP

At the beginning of the C++ source code, defined constants are declared so the rest of the code can reference them for various tasks. After clicking the “print check” button, the variables and objects are declared. Next, a simple if-then logic structure is used to test if a check book register record has been selected from the check book register screen. This is necessary because the check number from the check book register screen is needed to help create the printed check. Now initialize the variables for the check and check stub. Next, retrieve the following items from the controls on the currently displayed screen. These items include check number, vendor name, invoice description, check memorandum and paid date.

For the next step, a file stream must be opened to the binary check book register data file, “cbook.txt”. Here, a do-while loop structure is entered to collect the data for each invoice to be paid. The check number for each check book register record will be matched to the one retrieved from the current data entry screen. Each matched record will retrieve the date, expense code, invoice number, invoice total, early payment discount, and net invoice amount for each specific vendor invoice to be paid with this check. There can be no more than 10 invoices on the check stub in this particular application. With each pass through the do-while loop structure, the matched check book register record will be marked as paid and the net invoice amount will be accumulated. This total will become the numerical amount that will be converted to a verbal amount.

Upon verification that at least one matching check number was found in the do-while loop structure from above, the net invoice amount total will be specified in a character array called “totpay”. This character array will be extensively utilized in the conversion to a verbal amount momentarily. But first, a file stream must be opened to the vendor binary data file, “vendor.txt”. This will be another do-while loop structure that matches the retrieved vendor name from the currently displayed screen to what is in the data file for vendors. The vendor’s street, city, state and zip code are then retrieved upon a successful match and then formatted with some simple string operations to prepare for eventual printing on the check itself.

THE BRICK AND MORTAR

Here are some sets of character arrays that define some of the verbal components used to construct the verbal amount for the check. Each of these character array sets will be assigned a specific name for the purpose of narrating the software development algorithm that utilizes them for converting the numerical amount to a verbal amount.

1
2
3
4
5
6
7
8
9
10

char      am1[] = "NINETY";
char      am2[] = "EIGHTY";
char      am3[] = "SEVENTY";
char      am4[] = "SIXTY";
char      am5[] = "FIFTY";
char      am6[] = "FORTY";
char      am7[] = "THIRTY";
char      am8[] = "TWENTY";


The above character array contents are selectively concatenated to the verbal description variable depending on what numbers are in the second (2nd) and fifth (5th) positions to the left of the decimal point in the numerical amount to be converted. THIS IS GROUP A.

1
2
3
4
5
6
7
8
9
10
11

char      am9[] = "ONE";
char      am10[] = "TWO";
char      am11[] = "THREE";
char      am12[] = "FOUR";
char      am13[] = "FIVE";
char      am14[] = "SIX";
char      am15[] = "SEVEN";
char      am16[] = "EIGHT";
char      am17[] = "NINE";


The above character array contents are selectively concatenated to the verbal description variable depending on what numbers are in the first (1st), third (3rd) and fourth (4th) positions to the left of the decimal point in the numerical amount to be converted. THIS IS GROUP B.

1
2
3

char      am18[] = "THOUSAND";


This is concatenated to the verbal description variable after the “number of thousands figure” has been detected, which is the fourth (4th) position to the left of the decimal point in the numerical amount to be converted. THIS IS THE THOUSANDS DESIGNATOR.

1
2
3

char      am19[] = "HUNDRED";


This is concatenated to the verbal description variable after the “number of hundreds figure” has been detected, which is the third (3rd) position to the left of the decimal point in the numerical amount to be converted. THIS IS THE HUNDREDS DESIGNATOR.

1
2
3

char      am0[] = "ZERO";


This is not concatenated to the verbal description variable, but rather it is assigned after no other descriptors have been concatenated to the above variable at the end of processing. THIS IS THE ZERO DESIGNATOR.

1
2
3
4
5
6
7
8
9
10
11
12

char      am210[] = "TEN";
char      am211[] = "ELEVEN";
char      am212[] = "TWELVE";
char      am213[] = "THIRTEEN";
char      am214[] = "FOURTEEN";
char      am215[] = "FIFTEEN";
char      am216[] = "SIXTEEN";
char      am217[] = "SEVENTEEN";
char      am218[] = "EIGHTEEN";
char      am219[] = "NINETEEN";


The above character array contents are selectively concatenated to the verbal description variable depending on what numbers are in the first (1st) and fourth (4th) positions to the left of the decimal point in the numerical amount to be converted. THIS IS GROUP C.

STARTING CONSTRUCTION

The first thing to do here is initialize the 70 character character array “verbal_amount” with space characters to prepare it for being updated by the algorithm that converts the numerical amount in the character array “totpay” to the verbal counterpart. A counter variable “aa” will also be used to count how many characters are appended to the char array “verbal_amount”.

Next, check to see if the 5th digit to the left of the decimal point in the numerical character array “totpay” is greater than 0 (begin structure “a”). If true, then check to see if the 5th digit to the left of the decimal point in the numerical character array “totpay” is equal to 1 (begin structure “b”). If this is true, then use GROUP C to assign a descriptor to the verbal amount character array “verbal_amount” based on the number that is contained in the 4th digit to the left of the decimal place in the numerical character array “totpay” as shown here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

// if the 4th digit to the left of the decimal point is 0, then append
// "TEN" to the 'verbal_amount' array.
if(totpay[3] == 48) {
for(f=0; f<3; f++) verbal_amount[f] = am210[f];       
aa=3;
}
// if the 4th digit to the left of the decimal point is 1, then append
// "ELEVEN" to the 'verbal_amount' array.
if(totpay[3] == 49) {
for(f=0; f<6; f++) verbal_amount[f] = am211[f];       
aa=6;
}
// if the 4th digit to the left of the decimal point is 2, then append
// "TWELVE" to the 'verbal_amount' array.
if(totpay[3] == 50) {
for(f=0; f<6; f++) verbal_amount[f] = am212[f];       
aa=6;
}
// if the 4th digit to the left of the decimal point is 3, then append
// "THIRTEEN" to the 'verbal_amount' array.
if(totpay[3] == 51) {
for(f=0; f<8; f++) verbal_amount[f] = am213[f];       
aa=8;
}
// if the 4th digit to the left of the decimal point is 4, then append
// "FOURTEEN" to the 'verbal_amount' array.
if(totpay[3] == 52) {
for(f=0; f<8; f++) verbal_amount[f] = am214[f];       
aa=8;
}
// if the 4th digit to the left of the decimal point is 5, then append
// "FIFTEEN" to the 'verbal_amount' array.
if(totpay[3] == 53) {
for(f=0; f<7; f++) verbal_amount[f] = am215[f];       
aa=7;
}
// if the 4th digit to the left of the decimal point is 6, then append
// "SIXTEEN" to the 'verbal_amount' array.
if(totpay[3] == 54) {
for(f=0; f<7; f++) verbal_amount[f] = am216[f];        
aa=7;
}
// if the 4th digit to the left of the decimal point is 7, then append
// "SEVENTEEN" to the 'verbal_amount' array.
if(totpay[3] == 55) {
for(f=0; f<9; f++) verbal_amount[f] = am217[f];       
aa=9;
}
// if the 4th digit to the left of the decimal point is 8, then append
// "EIGHTEEN" // to the 'verbal_amount' array.
if(totpay[3] == 56) {
for(f=0; f<8; f++) verbal_amount[f] = am218[f];       
aa=8;
}
// if the 4th digit to the left of the decimal point is 9, then append
// "NINETEEN" // to the 'verbal_amount' array.
if(totpay[3] == 57) {
for(f=0; f<8; f++) verbal_amount[f] = am219[f];       
aa=8;
}


End structure “b”. Next, use GROUP A to assign a descriptor to the verbal amount character array “verbal_amount” based on the number that is contained in the 5th digit to the left of the decimal place in the numerical character array “totpay” as shown here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

// if the 5th digit to the left of the decimal point is 2, then append
// "TWENTY" to the 'verbal_amount' array.
if(totpay[2] == 50) {
for(f=0; f<6; f++) verbal_amount[f] = am8[f];         
aa=6;
}
// if the 5th digit to the left of the decimal point is 3, then append
// "THIRTY" to the 'verbal_amount' array.
if(totpay[2] == 51) {
for(f=0; f<6; f++) verbal_amount[f] = am7[f];         
aa=6; 
}
// if the 5th digit to the left of the decimal point is 4, then append
// "FORTY" to the 'verbal_amount' array.
if(totpay[2] == 52) {
for(f=0; f<5; f++) verbal_amount[f] = am6[f];         
aa=5; 
}
// if the 5th digit to the left of the decimal point is 5, then append
// "FIFTY" to the 'verbal_amount' array.
if(totpay[2] == 53) {
for(f=0; f<5; f++) verbal_amount[f] = am5[f];         
aa=5;
}
// if the 5th digit to the left of the // decimal point is 6, then append
// "SIXTY" to the 'verbal_amount' array.
if(totpay[2] == 54) {
for(f=0; f<5; f++) verbal_amount[f] = am4[f];         
aa=5;
}
// if the 5th digit to the left of the decimal point is 7, then append
// "SEVENTY" to the 'verbal_amount' array.
if(totpay[2] == 55) {
for(f=0; f<7; f++) verbal_amount[f] = am3[f];         
aa=7;
}
// if the 5th digit to the left of the decimal point is 8, then append
// "EIGHTY" to the 'verbal_amount' array.
if(totpay[2] == 56) {
for(f=0; f<6; f++) verbal_amount[f] = am2[f];         
aa=6;
}
// if the 5th digit to the left of the decimal point is 9, then append
// "NINETY" to the 'verbal_amount' array.
if(totpay[2] == 57) {
for(f=0; f<6; f++) verbal_amount[f] = am1[f];         
aa=6;
}


Begin structure “c”. If the 5th digit to the left of the decimal point in the numerical character array “totpay” does not equal 1, then use GROUP B to assign a descriptor to the verbal amount character array “verbal_amount” based on the number that is contained in the 4th digit to the left of the decimal place in the numerical character array “totpay” as shown here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

// if the 4th digit to the left of the decimal point is 1, then append
// "ONE" to the 'verbal_amount' array.
if(totpay[3] == 49) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am9[f];    
aa=aa+4;
}
// if the 4th digit to the left of the decimal point is 2, then append
// "TWO" to the 'verbal_amount' array.
if(totpay[3] == 50) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am10[f];   
aa=aa+4;
}
// if the 4th digit to the left of the decimal point is 3, then append
// "THREE" to the 'verbal_amount' array.
if(totpay[3] == 51) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am11[f];   
aa=aa+6;
}
// if the 4th digit to the left of the decimal point is 4, then append
// "FOUR" to the 'verbal_amount' array.
if(totpay[3] == 52) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am12[f];   
aa=aa+5;
}
// if the 4th digit to the left of the decimal point is 5, then append
// "FIVE" to the 'verbal_amount' array.
if(totpay[3] == 53) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am13[f];   
aa=aa+5;
}
// if the 4th digit to the left of the decimal point is 6, then append
// "SIX" to the 'verbal_amount' array.
if(totpay[3] == 54) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am14[f];   
aa=aa+4;
}
// if the 4th digit to the left of the decimal point is 7, then append
// "SEVEN" to the 'verbal_amount' array.
if(totpay[3] == 55) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am15[f];   
aa=aa+6;
}
// if the 4th digit to the left of the decimal point is 8, then append
// "EIGHT" to the 'verbal_amount' array.
if(totpay[3] == 56) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am16[f];   
aa=aa+6;
}
// if the 4th digit to the left of the decimal point is 9, then append
//  "NINE" to the 'verbal_amount' array.
if(totpay[3] == 57) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am17[f];   
aa=aa+5;
}


End structure “c”. Next, append "THOUSAND" to the character array “verbal_amount” and end structure “a”.

Begin structure “d”. If the 5th digit to the left of the decimal point is less than 1 and the 4th digit to the left of the decimal point is greater than 0, then proceed. Use GROUP B to assign a descriptor to the verbal amount character array “verbal_amount” based on the number that is contained in the 4th digit to the left of the decimal place in the numerical character array “totpay” as shown here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

// if the 4th digit to the left of the decimal point is 1, then append
// "ONE" to the 'verbal_amount' array.
if(totpay[3] == 49) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am9[f];     
aa=aa+4;
}
// if the 4th digit to the left of the decimal point is 2, then append
// "TWO" to the 'verbal_amount' array.
if(totpay[3] == 50) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am10[f];    
aa=aa+4;
}
// if the 4th digit to the left of the decimal point is 3, then append
// "THREE" to the 'verbal_amount' array.
if(totpay[3] == 51) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am11[f];    
aa=aa+6;
}
// if the 4th digit to the left of the decimal point is 4, then append
// "FOUR" to the 'verbal_amount' array.
if(totpay[3] == 52) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am12[f];    
aa=aa+5;
}
// if the 4th digit to the left of the decimal point is 5, then append
// "FIVE" to the 'verbal_amount' array.
if(totpay[3] == 53) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am13[f];    
aa=aa+5;
}
// if the 4th digit to the left of the decimal point is 6, then append
// "SIX" to the 'verbal_amount' array.
if(totpay[3] == 54) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am14[f];    
aa=aa+4;
}
// if the 4th digit to the left of the decimal point is 7, then append
// "SEVEN" to the 'verbal_amount' array.
if(totpay[3] == 55) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am15[f];    
aa=aa+6;
}
// if the 4th digit to the left of the decimal point is 8, then append
// "EIGHT" to the 'verbal_amount' array.
if(totpay[3] == 56) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am16[f];    
aa=aa+6;
}
// if the 4th digit to the left of the decimal point is 9, then append
// "NINE" to the 'verbal_amount' array.
if(totpay[3] == 57) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am17[f];    
aa=aa+5;
}


Next, append "THOUSAND" to the character array “verbal_amount” and end structure “d”.

Begin structure “e”. If the 3rd digit to the left of the decimal point is greater than 0, then proceed. Use GROUP B to assign a descriptor to the verbal amount character array “verbal_amount” based on the number that is contained in the 3rd digit to the left of the decimal place in the numerical character array “totpay” as shown here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
	
// if the 3rd digit to the left of the decimal point is 1, then append
// "ONE" to the 'verbal_amount' array.
if(totpay[4] == 49) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am9[f];    
aa=aa+4;
}
// if the 3rd digit to the left of the decimal point is 2, then append
// "TWO" to the 'verbal_amount' array.
if(totpay[4] == 50) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am10[f];   
aa=aa+4;
}
// if the 3rd digit to the left of the decimal point is 3, then append
// "THREE" to the 'verbal_amount' array.
if(totpay[4] == 51) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am11[f];   
aa=aa+6;
}
// if the 3rd digit to the left of the decimal point is 4, then append
// "FOUR" to the 'verbal_amount' array.
if(totpay[4] == 52) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am12[f];   
aa=aa+5;
}
// if the 3rd digit to the left of the decimal point is 5, then append
// "FIVE" to the 'verbal_amount' array.
if(totpay[4] == 53) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am13[f];   
aa=aa+5;
}
// if the 3rd digit to the left of the decimal point is 6, then append
// "SIX" to the 'verbal_amount' array.
if(totpay[4] == 54) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am14[f];   
aa=aa+4;
}
// if the 3rd digit to the left of the decimal point is 7, then append
// "SEVEN" to the 'verbal_amount' array.
if(totpay[4] == 55) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am15[f];   
aa=aa+6;
}
// if the 3rd digit to the left of the decimal point is 8, then append
// "EIGHT" to the 'verbal_amount' array.
if(totpay[4] == 56) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am16[f];   
aa=aa+6;
}
// if the 3rd digit to the left of the decimal point is 9, then append
// "NINE" to the 'verbal_amount' array.
if(totpay[4] == 57) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am17[f];   
aa=aa+5;
}


Next, append "HUNDRED" to the character array “verbal_amount” and end structure “e”.

Now check to see if the 2nd digit to the left of the decimal point in the numerical character array “totpay” is greater than 0 (begin structure “f”). If true, then check to see if the 2nd digit to the left of the decimal point in the numerical character array “totpay” is equal to 1 (begin structure “g”). If true, then use GROUP C to assign a descriptor to the verbal amount character array “verbal_amount” based on the number that is contained in the 1st digit to the left of the decimal place in the numerical character array “totpay” as shown here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

// if the 1st digit to the left of the decimal point is 0, then append
// "TEN" to the 'verbal_amount' array.
if(totpay[6] == 48) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am210[f];  
aa = aa + 4;
}
// if the 1st digit to the left of the decimal point is 1, then append
// "ELEVEN" to the 'verbal_amount' array.
if(totpay[6] == 49) {
for(f=0; f<6; f++) verbal_amount[f+aa+1] = am211[f];  
aa = aa + 7;
}
// if the 1st digit to the left of the decimal point is 2, then append
// "TWELVE" to the 'verbal_amount' array.
if(totpay[6] == 50) {
for(f=0; f<6; f++) verbal_amount[f+aa+1] = am212[f];  
aa = aa + 7;
}
// if the 1st digit to the left of the decimal point is 3, then append
// "THIRTEEN" to the 'verbal_amount' array.
if(totpay[6] == 51) {
for(f=0; f<8; f++) verbal_amount[f+aa+1] = am213[f];  
aa = aa + 9;
}
// if the 1st digit to the left of the decimal point is 4, then append
// "FOURTEEN" to the 'verbal_amount' array.
if(totpay[6] == 52) {
for(f=0; f<8; f++) verbal_amount[f+aa+1] = am214[f];  
aa = aa + 9;
}
// if the 1st digit to the left of the decimal point is 5, then append
// "FIFTEEN" to the 'verbal_amount' array.
if(totpay[6] == 53) {
for(f=0; f<7; f++) verbal_amount[f+aa+1] = am215[f];  
aa = aa + 8;
}
// if the 1st digit to the left of the decimal point is 6, then append
// "SIXTEEN" to the 'verbal_amount' array.
if(totpay[6] == 54) {
for(f=0; f<7; f++) verbal_amount[f+aa+1] = am216[f];  
aa = aa + 8;
}
// if the 1st digit to the left of the decimal point is 7, then append
// "SEVENTEEN" to the 'verbal_amount' array.
if(totpay[6] == 55) {
for(f=0; f<9; f++) verbal_amount[f+aa+1] = am217[f];  
aa = aa + 10;
}
// if the 1st digit to the left of the decimal point is 8, then append
// "EIGHTEEN" to the 'verbal_amount' array.
if(totpay[6] == 56) {
for(f=0; f<8; f++) verbal_amount[f+aa+1] = am218[f];  
aa = aa + 9;
}
// if the 1st digit to the left of the decimal point is 9, then append
// "NINETEEN" to the 'verbal_amount' array.
if(totpay[6] == 57) {
for(f=0; f<8; f++) verbal_amount[f+aa+1] = am219[f];  
aa = aa + 9;
}


End structure “g”. Next, use GROUP A to assign a descriptor to the verbal amount character array “verbal_amount” based on the number that is contained in the 2nd digit to the left of the decimal place in the numerical character array “totpay” as shown here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

// if the 2nd digit to the left of the decimal point is 2, then append
// "TWENTY" to the 'verbal_amount' array.
if(totpay[5] == 50) {
for(f=0; f<6; f++) verbal_amount[f+aa+1] = am8[f];    
aa=aa+7;
}
// if the 2nd digit to the left of the decimal point is 3, then append
// "THIRTY" to the 'verbal_amount' array.
if(totpay[5] == 51) {
for(f=0; f<6; f++) verbal_amount[f+aa+1] = am7[f];    
aa=aa+7;
}
// if the 2nd digit to the left of the decimal point is 4, then append
// "FORTY" to the 'verbal_amount' array.
if(totpay[5] == 52) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am6[f];    
aa=aa+6;
}
// if the 2nd digit to the left of the decimal point is 5, then append
// "FIFTY" to the 'verbal_amount' array.
if(totpay[5] == 53) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am5[f];    
aa=aa+6;
}
// if the 2nd digit to the left of the decimal point is 6, then append
// "SIXTY" to the 'verbal_amount' array.
if(totpay[5] == 54) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am4[f];    
aa=aa+6;
}
// if the 2nd digit to the left of the decimal point is 7, then append
// "SEVENTY" to the 'verbal_amount' array.
if(totpay[5] == 55) {
for(f=0; f<7; f++) verbal_amount[f+aa+1] = am3[f];    
aa=aa+8;
}
// if the 2nd digit to the left of the decimal point is 8, then append
// "EIGHTY" to the 'verbal_amount' array.
if(totpay[5] == 56) {
for(f=0; f<6; f++) verbal_amount[f+aa+1] = am2[f];    
aa=aa+7;
}
// if the 2nd digit to the left of the decimal point is 9, then append
// "NINETY" to the 'verbal_amount' array.
if(totpay[5] == 57) {
for(f=0; f<6; f++) verbal_amount[f+aa+1] = am1[f];    
aa=aa+7;
}


End structure “f”. If the 1st digit to the left of the decimal point is greater than 0 and the 2nd digit to the left of the decimal point does not equal 1, then begin structure “h”. Use GROUP B to assign a descriptor to the verbal amount character array “verbal_amount” based on the number that is contained in the 1st digit to the left of the decimal place in the numerical character array “totpay” as shown here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

// if the 1st digit to the left of the decimal point is 1, then append
// "ONE" to the 'verbal_amount' array.
if(totpay[6] == 49) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am9[f];      
aa=aa+4;
}
// if the 1st digit to the left of the decimal point is 2, then append
// "TWO" to the 'verbal_amount' array.
if(totpay[6] == 50) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am10[f];     
aa=aa+4;
}
// if the 1st digit to the left of the decimal point is 3, then append
// "THREE" to the 'verbal_amount' array.
if(totpay[6] == 51) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am11[f];     
aa=aa+6;
}
// if the 1st digit to the left of the decimal point is 4, then append
// "FOUR" to the 'verbal_amount' array.
if(totpay[6] == 52) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am12[f];     
aa=aa+5;
}
// if the 1st digit to the left of the decimal point is 5, then append
// "FIVE" to the 'verbal_amount' array.
if(totpay[6] == 53) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am13[f];     
aa=aa+5;
}
// if the 1st digit to the left of the decimal point is 6, then append
// "SIX" to the 'verbal_amount' array.
if(totpay[6] == 54) {
for(f=0; f<3; f++) verbal_amount[f+aa+1] = am14[f];     
aa=aa+4;
}
// if the 1st digit to the left of the decimal point is 7, then append
// "SEVEN" to the 'verbal_amount' array.
if(totpay[6] == 55) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am15[f];     
aa=aa+6;
}
// if the 1st digit to the left of the decimal point is 8, then append
// "EIGHT" to the 'verbal_amount' array.
if(totpay[6] == 56) {
for(f=0; f<5; f++) verbal_amount[f+aa+1] = am16[f];     
aa=aa+6;
}
// if the 1st digit to the left of the decimal point is 9, then append
// "NINE" to the 'verbal_amount' array.
if(totpay[6] == 57) {
for(f=0; f<4; f++) verbal_amount[f+aa+1] = am17[f];     
aa=aa+5;
}


End structure “h”. If nothing was translated to a verbal amount from the above code (the “aa” counter variable is equal to 0 from not being incremented in the concatenation programming from above), then assign the ZERO DESIGNATOR to the verbal amount character array “verbal_amount”. Lastly, skip a space character in the verbal amount character array “verbal_amount” and append “AND”. Skip another space character and append the two (2) characters for cents in the numerical character array “totpay” followed by “/100”.

CONCLUSION

As seen from the above narrative, application development saves a lot of time and labor. When I create software, I don’t really care about making it aesthetically pleasing to the eye as long as it is easy to use, reliable and reasonably fast. This is what business people really care about. My developer skills can be traced back to the early 1990s from designing business software. Please contact me through my software developer website if you would like to learn more about the services I offer.