Re: Converting qbasic to Euphoria?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi Ed,

----------
> From: Ed Davis <guest at RapidEuphoria.com>
> To: EUforum at topica.com
> Subject: Converting qbasic to Euphoria?
> Sent: 28 jul 2004 y. 22:22
> 
> 
> Can the following qbasic code be easily 
> converted to Euphoria?
> Note that I am not looking for an exact 
> translation. My goal is to be able to 
> use Euphoria to graph some simple algebraic
> equations.  
> Using DOS (as opposed to Linux or Windows)
> is ok too.
>
> Thanks for any help!
> 
> DIM a, b, c, x AS DOUBLE
> SCREEN (12)
> WINDOW (-8, 6)-(8, -6)
> LINE (-8, 0)-(8, 0)   'X axis
> LINE (0, 6)-(0, -6)   'Y axis
> FOR x = -8 TO 8 STEP .025
>     a = x ^ 2
>     b = SIN(x)
>     c = COS(x)
>     PSET (x, a)
>     PSET (x, b)
>     PSET (x, c)
> NEXT x

Try please this DOS32 program,
works for me.

include graphics.e

atom a, b, c
if graphics_mode(18) then end if
-- > WINDOW (-8, 6)-(8, -6) -- there is no 
-- WINDOW in the standard EU, but 
-- there is one lib in The Archive with 
-- that WINDOW feature.
-- So, I just mapped your task into 640x480 screen
draw_line(5,{{0,239},{639,239}}) -- X axis
draw_line(5,{{319,0},{319,479}}) -- Y axis
 for x = -8 to 8 by .025 do
     a = power(x, 2)
     b = sin(x)
     c = cos(x)
     pixel(11,{x * 80 + 319, a * 80 + 239})
     pixel(12,{x * 80 + 319, b * 80 + 239})
     pixel(14,{x * 80 + 319, c * 80 + 239})
 end for


Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu