cmsoft wrote:Silvio, y crear un nuevo arreglo no?
- Code: Select all Expand view
#include 'fivewin.ch'
Function test()
local aTmp:={}, aResu := {}
local nAt
local nTotale
local nValore := 9
For n= 1 to 90
For k= 1 to 90
nTotale := k+n
If nTotale=nvalore
nAt := AScan( aTmp, { |a| a[1] = n .or. a[2] = n} )
aadd(aTmp,{n,k,nAt})
Endif
next
next
//erased repeated
for t= 1 to len(aTmp)
If aTmp[t][3]=0
Aadd( aResu, aTmp[t] )
Endif
next
xbrowser aResu
return nil
As I wrote on private mail the problem is another
for the two dimensional array i solved
- Code: Select all Expand view
For n= 1 to 90
For k= 1 to 90
nTotale := Calc_Ambi_Sum_dist(n,k,ntipo)
If nTotale=nvalore
nAt := AScan( aTmp, { |a| a[1] = n .or. a[2] = n} )
If nAt == 0
aadd(aTmp,{n,k})
Endif
Endif
next
next
- Code: Select all Expand view
Function Calc_Ambi_Sum_dist(n1,n2,nTipo)
//---------------------------------------
local nNum:=0
local nTemp:=0
Do case
case nTipo= 1 // suma ciclométrica ok
nTemp:= n1+n2
If nTemp > 90
nTemp:= ntemp-90 //el exterior 90
Endif
case nTipo= 2 //distancia ciclométrica ok
IF n2>n1
nTemp:= n2-n1
else
nTemp:= n1-n2
Endif
If nTemp > 45 // el exterior 45
nTemp:= 90-nTemp
Endif
Case nTipo= 3 //suma matemática ok
nTemp:= n1+n2
case ntipo = 4 // distancia matemática ok
IF n2>n1
nTemp:= n2-n1
else
nTemp:= n1-n2
Endif
Endcase
nNum := ntemp
return nNum
for the three-dimensional array I find it difficult to find the numbers to associate
I explain you
1) I speak of two numbers because in the Italian lottery two numbers are equal to both
2) I speak of three numbers because in the Italian lottery three numbers are equal to three
the calculations are:
1)
cyclometric sum2)
cyclometric distance3)
math addition4)
mathematical distancefor the cyclometric sum it is always necessary to subtract 90 if the sum exceeds 90
The cyclometric distance between two numbers is obtained by calculating the arithmetic difference (major minus minor); if the result exceeds "the limit" 45, the latter is subtracted from the 90 set.
The mathematical distance between two numbers is obtained by calculating the arithmetic difference (major minus minor); if the result exceeds "the limit" 90, the latter is subtracted from the 90 set.
for
l'array with three numbers to create this cycle
- Code: Select all Expand view
For n= 1 to 90
For k= 1 to 90
For j= 1 to 90
nTotale := Calc_Terni_Sum_dist(n,k,j,ntipo)
If nTotale=nvalore
nAt := AScan( aTmp, { |a| a[1] = n .and. a[2] = n .or.;
a[2] = n .and. a[3] = n} )
If nAt == 0
aadd(aTmp,{n,k,j})
Endif
Endif
next
next
next
and created this other function for the calculation but it is wrong
- Code: Select all Expand view
Function Calc_Terni_Sum_dist(n1,n2,n3,nTipo)
//---------------------------------------
local nNum:=0
local nTemp:=0
Do case
case nTipo= 1 // suma ciclométrica ok
nTemp:= n1+n2+n3
If nTemp > 90
nTemp:= ntemp-90 //el exterior 90
Endif
case nTipo= 2 //distancia ciclométrica ok
IF n1 > n2 .or. n1 >n3
nTemp:= n1-n2-n3
elseif n2 > n1 .or. n2 >n3
nTemp:= n2-n3-n1
elseif n3 > n1 .or. n3 > n2
nTemp:= n3-n1-n2
Endif
If nTemp > 45 // el exterior 45
nTemp:= 90-nTemp
Endif
Case nTipo= 3 //suma matemática ok
nTemp:= n1+n2
case ntipo = 4 // distancia matemática ok
IF n1 > n2 .or. n1 >n3
nTemp:= n1-n2-n3
elseif n2 > n1 .or. n2 >n3
nTemp:= n2-n3-n1
elseif n3 > n1 .or. n3 > n2
nTemp:= n3-n1-n2
Endif
Endcase
nNum := ntemp
return nNum
how could i solve?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com