1. RE: can't figure this out

George Walters wrote:
> Here's the code...
> 
>  printf(1,"%d  %d\n",{screenTable[i][8],screenTable[i][7]})        -- 
>  this
> prints a 9 and a 2  so table8 is 9 and table7 is 2
> 
>    tmp =
> ntf("%d",screenTable[i][8])&"."&sprintf("%d",screenTable[i][7])     -- 
> if i
> print this with a printf i get 57.00 ???????
> 
> why is tmp not 9.2 ??
> 
> 
george:

  Are you sure that the value [i] is the same? Try printing it
  out at the same point in your program loop
Bernie

new topic     » topic index » view message » categorize

2. RE: can't figure this out

>  printf(1,"%d  %d\n",{screenTable[i][8],screenTable[i][7]})        -- this
> prints a 9 and a 2  so table8 is 9 and table7 is 2
>
>    tmp =
> ntf("%d",screenTable[i][8])&"."&sprintf("%d",screenTable[i][7])
>   -- if i
> print this with a printf i get 57.00 ???????
>
> why is tmp not 9.2 ??

What would happen if you used {} in the second assignment?

tmp = sprintf("%d", { screenTable[i][8] } )&"."&sprintf("%d", {
screenTable[i][7] } )

new topic     » goto parent     » topic index » view message » categorize

3. RE: can't figure this out

Hi George,
the problem is that you are using printf("%d", tmp) rather than printf("%s",
{tmp}).
This demonstrates the differences...

-----------
sequence screenTable

screenTable = 
    {{1,2,3,4,5,6,2,9,0},
     {0,9,8,7,6,5,4,3,2}
    }
sequence tmp

for i = 1 to length(screenTable) do
    printf(1,"%d  %d\n",{screenTable[i][8],screenTable[i][7]})
    tmp =
sprintf("%d",screenTable[i][8])&"."&sprintf("%d",screenTable[i][7])
    printf(1, "%d\n", tmp)
    printf(1, "%s\n", {tmp})
    puts(1, tmp & "\n")
end for
--------------
cheers,
Derek Parnell
Senior Design Engineer
Global Technology Australasia Ltd
dparnell at glotec.com.au

---------------------



> -----Original Message-----
> From: Derek Parnell [mailto:ddparnell at bigpond.com]
> Sent: Wednesday, 29 August 2001 9:18 AM
> To: Derek at Work
> Subject: Fwd: can't figure this out
> 
> 
> ------- Start of forwarded message -------
> From: George Walters <gwalters at sc.rr.com>
> To: EUforum <EUforum at topica.com>
> Reply-To: EUforum at topica.com
> Subject: can't figure this out
> Date: 29/08/2001 7:57:04 AM
> 
> 
> Here's the code...
> 
>  printf(1,"%d  %d\n",{screenTable[i]
> [8],screenTable[i][7]})        -- this
> prints a 9 and a 2  so table8 is 9 and 
> table7 is 2
> 
>    tmp =
> ntf("%d",screenTable[i][8])&"."&sprintf("%
> d",screenTable[i][7])     -- if i
> print this with a printf i get 57.00 
> ???????
> 
> why is tmp not 9.2 ??
> 
> 
> ...george
> 
> ddparnell at bigpond.com
> 
> er
> 
> 
> -------- End of forwarded message --------
> 
> 


--------------------------------------------------------------------
Global Technology Australasia Limited is the industry leader in next
generation financial software solutions: www.glotec.com.au
Delivering the Future of Banking Today
CAUTION - This email and any files attached may contain privileged and
confidential information intended solely for the use of the individual or
entity to whom they are addressed. If you are not the intended recipient of
this message you are hereby notified that any use, dissemination,
distribution or reproduction of this message is prohibited. If you have
received this message in error please notify the sender immediately. Any
views expressed in this message are those of the individual sender and may
not necessarily reflect the views of Global Technology Australasia Limited.
--------------------------------------------------------------------

new topic     » goto parent     » topic index » view message » categorize

4. RE: can't figure this out

George Walters wrote:
> Bernie... run this
> 
> sequence screenTable, tmp
> 
> screenTable = {0,0,0,0,0,0,2,8}
> 
> 
> printf(1,"%d  %d\n",{screenTable[8],screenTable[7]})
> tmp = sprintf("%d",screenTable[8])&"."&sprintf("%d",screenTable[7])
> printf(1,"%4.2f\n",tmp)
> 
> tmp = gets(0)
>  

george:

Why are you using the sprintf() when you can do this

printf(1,"%d.%0.2d\n",{screenTable[8],screenTable[7]})


Bernie

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu