Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Challenge: International version of PRINT USING
#21
Plasma, you're too much! "It helps to have the source code to Qbasic" :rotfl:

About the currency symbol shakiness, I can't remember now what it was.
*****
Reply
#22
*Well, this challenge is getting as cold as yesterday's mashed potatoes.

Except for Plasma, no one really gives a diddley about the problem.

So, I'm naming Plasma the winner for a brilliant, though different, solution.

Now I'm going to post my simplistic solution.
I'm tired so I'll just walk you through the logic.

I got the idea from a function in Ethan Winer's QuickPak library which allows you to assign the results of a PRINT USING to a variable. So, without using this QuickPak function:

OPEN A WORK FILE FOR OUTPUT TO #2.
USING USING A NORMAL MASK, DO A PRINT USING #2.
Now on file 2 you have the result formatted according to the normal mask.
CLOSE THE WORK FILE, AND READ IN THE FORMATTED RESULT.

NOW, IF YOU WANT TO CONVERT THE RESULT TO EUROPEAN FORMAT, CONTINUE.
USE AN INSTR TO CONVERT THE DECIMAL POINT TO AN "X" CHARACTER, AND USE AN INSTR TO CONVERT THE COMMAS TO A "Y".
This is to distinguish original decimal point and commas.
THEN CONVERT THE X'S TO COMMAS AND THE Y'S TO DECIMAL POINTS.
THEN IF YOU WANT TO DISPLAY SOME OTHER CURRENCY CHARACTER, CONVERT THE DOLLAR-SIGN TO THAT CHARACTER.

Simple, yes. Elegant, well that's a matter of opinion. Many people don't like to use work files. In this case, the work file is 95% of the solution.

Opinions?
*****
Reply
#23
Moneo,
It isn't that no one was interested in the challenge, we just weren't looking at it as having a simple solution. nath and I were both considering it as a rewrite of the PRINT USING function.

I like yours. An output and an input isn't real fast, but most of the time it wouldn't be noticable.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply
#24
Thanks, SCM, those are exactly my feelings too.
*****
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)