hi all:
I am having troble with arrays and I do not understand them enough to write it right.
I am in need of some help in foxpro 2.6. I need to write a array. In the array I will read in 4 numbers. If any of the numbers equal each other either 2 the same or 3 or all four I want to put an "X" in a column of the array showing they are equal. I also want to populate another column with the largest number and fianl the last column is all the numbers in the array.
examples of numbers used in the array
30,30,23,12 - 2 same
40,12,15,90 - 0 same
50,50,50,12 - 3 same
30,30,30,30 - 4 same
seq same largest number
1 X 30 30
2 X 30
3 23
4 12
1. read in 4 numbers x1,x2x3,x4, sum the numbers, see if numbers equal 100 print x1,x2,x3,x4 else if not error trap
2. see if one of xi = 100 and all remaining will = 0 print x1,x2,x3,x4
, if not go to step 3
3. set xi = xi + .5
4. truncate xi droping the 2 decimal numbers
5. total x1_x2_x3_x4 = xtot
6. if xtot = 100, print x1,x2,x3,x4
7. if xtot <> 100 compute the difference t_diff
8. NEQ number of equal numbers
IF NEQ =4, THEN X1+X2+X3+X4 = 25%
IF NEQ=3 THEN ADD DIFF TO THE UNEQUAL NUMBER AND USE THESE NUMBERS
IF NEQ =2 THEN ADD DFF TO THE LARGEST NUMBER AND USE THE NUMBERS
if NEQ = 0 ADD DIFF TO THE LARGEST NUMBER AND USE THESE NUMBERS
IN THE ARRAY i WANT TO PUT "X" IN A COLUMN THAT SHOWS NUMBERS ARE EQUAL AND IN ANOTHER COLUMN PRINT THE LARGEST NUMBER
THERE SHOULD BY 4 COLUMNS
i AM ALSO IN THE NEED TO PAST IN PARAMETERS
P_NUM1, P_NUM2, P_NUM3,P_NUM4, P_NUMBER
P_NUMBER IS A STRING OF P_NUM1,P_NUM2,P_NUM3,P_NUM4
Can anyone help me?
Thanks
Peter
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only