Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Arrays
Message
From
20/06/2001 23:52:01
Gil Munk
The Scarborough Group, Inc.
Baltimore, Maryland, United States
 
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Title:
Re: Arrays
Miscellaneous
Thread ID:
00519817
Message ID:
00521752
Views:
17
Peter,
I was with you until the >seq same larget number. Could you explain that and also write out the step 1 thru 8 again a little more clearly for me?
I've worked with arrays for a while. It might help to think of arrays as tables existing only in memory where you can:
set the size in rows and columns - DIMENSION aMyArray[1,5] ,
insert rows/columns - AINS()
delete rows/columns - ADEL()
look for specific data - ASEEK()

You refer to each 'cell' or 'field' in an array by it's row and column coordinate, ie., cArrayName[nRow, nColumn] where nRow is the number of the row and nColumn is the column number.

I've usually handled problem like yours with various looping structures such as FOR...ENDFOR

Look in the FoxPro help table for information on the functions listed above and others like ASUBSCRIPT(), AELEMENT(), ALEN(), etc...


>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
>
>>Can anyone help me?
>>
>>Thanks
>>
>>Peter
Gil Munk


"If a nation expects to be ignorant and free, it expects what never was and never will be." - Thomas Jefferson
Previous
Reply
Map
View

Click here to load this message in the networking platform