Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Program for getting denomination
Message
De
09/12/1998 17:53:34
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
08/12/1998 00:34:55
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordanie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00164962
Message ID:
00165850
Vues:
37
>Is there a program avl for getting denomination of given amount..
>
>Something like this...
>
>100X3=??
>50X1=??
>etc etc

* This list gives the available currency units in a semicolon delimited list. Just substitute your values
#define c_spis "100;50;20;10;5;1;.50;.10;.01"
maxbank=words(c_spis, ";")
* pictures for the quantity, currency unit value and the final amount
pc_ko="9,999"
pc_bank="9,999.99"
g_pc="999,999.99"
k1=0
k2=k1+len(pc_ko)+4
k3=k2+len(pc_bank)+3

if type("g_pc")#"C"
	g_pc="99,999,999.99"
endif
if type("apoJ(1)")="N"
	maxbank=alen(apoJ)
endif
* apoJ[] holds the value of currency units
* apoK[] holds the number of units of each size
* apoQ[] holds the value in each of units
if type("apoJ(1)")#"N"
	spisapo= c_spis
	maxbank=words(spisapo,";")
	dime apoJ(maxbank), apoK(maxbank), apoQ(maxbank)
	apoJ=0
	apoQ=0
	apoK=0
	for i= 1 to maxbank
		apoJ(i)=val(wordnum(spisapo,i,";"))
	endf


	priv i, _izn
	_izn=TheQuantity
	for i=1 to maxbank
		apoK(i)=apoK(i)+int(_izn/apoJ(i))
		apoQ(i)=apoK(i)*apoJ(i)
		_izn=_izn % apoJ(i)
	endf
	for i=1 to maxbank
	if apoK(i)#0
		? apoK(i) pict pc_ko at k1, "*",	;
			apoJ(i) pict pc_bank at k2, "=",	;
			apoQ(i) pict g_pc at k3
	endif
endf
endif
HTH

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform