## Search found 7069 matches

Nov 18, 2018 17:14
Forum: Tips and Tricks
Topic: The Mergesort algorithm.
Replies: 13
Views: 195

### Re: The Mergesort algorithm.

I changed delete tmp to delete[] tmp

Joshy
Nov 17, 2018 23:35
Forum: General
Topic: Understanding WINDOW/VIEWPORT, inverting coordinates?
Replies: 9
Views: 146

### Re: Understanding WINDOW/VIEWPORT, inverting coordinates?

From my point of view this isn't a bug for example if you have a screen of 100 x 100 pixels then the right bottom corner are at 99,99 and not 100,100 wrong line (0 , 0) - (100 , 100), 15, B right line (0 , 0) - (100 - 100/100, 100 - 100/100), 15 ,B is the same as line (0 , 0) - ( 99, 99 ), 15, B sam...
Nov 17, 2018 22:49
Forum: Tips and Tricks
Topic: The Mergesort algorithm.
Replies: 13
Views: 195

### The Mergesort algorithm.

Only for fun I tested the "merge sort" algorithm. https://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Merge_sort_algorithm_diagram.svg/249px-Merge_sort_algorithm_diagram.svg.png Wikipedia: Mergesort an comparison based sorting algorithm. Joshy #include once "crt/string.bi" ...
Nov 16, 2018 13:42
Forum: General
Topic: raytrace try
Replies: 23
Views: 1063

### Re: raytrace try

Nice simplex noise textures.

Joshy
Nov 16, 2018 2:35
Forum: Tips and Tricks
Topic: Function roots by bisection.
Replies: 6
Views: 149

### Re: Function roots by bisection.

Four years ago I wrote an easy to understand expression parser and math solver. https://www.freebasic.net/forum/viewtopic.php?f=7&t=16664 I added set/get var and the assignment operator to day. ' ' main ' screenres 640,480 color 0,7 : cls var fn = "Sin(x^2)^2/x - Exp(x) + Cos(3*x) + 2*x*sin...
Nov 16, 2018 2:31
Forum: Tips and Tricks
Topic: Another easy to understand expression solver.
Replies: 34
Views: 6185

### Re: Another easy to understand expression solver.

Added set/get var and added the assignment operator see first post. Joshy ' ' copy the code from first post here ' screenres 640,480 color 0,7 : cls var fn = "Sin(x^2)^2/x - Exp(x) + Cos(3*x) + 2*x*sin(x) + 1" var minX = -6.0 , maxX = 2.0, xRange = maxX - minX var minY = -10.0, maxY = 6.0,...
Nov 15, 2018 20:29
Forum: Tips and Tricks
Topic: Function roots by bisection.
Replies: 6
Views: 149

### Re: Function roots by bisection.

A compile time function plotter has nothing to do with a run time f(x) solver.

You know expression parsing range checking ...

var f = "Sin(x^2)^2/x-Exp(x)+Cos(3*x)+2*x*sin(x)"

Plot( f, +1 , -6,2 )

How ever your code is simple and clean good job.

Joshy
Nov 15, 2018 20:13
Forum: Libraries
Topic: FLTK C for FreeBASIC Jan 09, 2017
Replies: 171
Views: 22033

### Re: FLTK C for FreeBASIC Jan 09, 2017

Reminds me on good old Visual Basic 4/5/6 days :-=) type Control extends object type Button extends Control ... type Container extends Control type Listbox extends Container type Toolbar extends Container ... type Form extends Container Joshy How easy is that: #include once "fltk-addon.bi"...
Nov 14, 2018 7:24
Forum: Libraries
Topic: FLTK C for FreeBASIC Jan 09, 2017
Replies: 171
Views: 22033

### Re: FLTK C for FreeBASIC Jan 09, 2017

I'm working in my rare spare time on a new FLTK add on. May be my next Christmas gift for you. It becomes easier than ever before :-) Joshy http://shiny3d.de/public/libs/fltk-c/addon.png Old C style: #include once "fltk-c.bi" sub ButtonClick cdecl (byval button as FL_WIDGET ptr, byval arg ...
Nov 06, 2018 1:24
Forum: General
Topic: How to grab escape-sequence keycodes?
Replies: 8
Views: 206

### Re: How to grab escape-sequence keycodes?

If you read from stdin you use

Open Cons For Input As #hFile

then my posted solution will work

if not why

you can post the code also

Joshy
Nov 06, 2018 0:58
Forum: General
Topic: Russian Sorting Halves Danilin
Replies: 11
Views: 273

### Re: Russian Sorting Halves Danilin

I would name it split sort :-) (see function arraySplit) Joshy 'function arraySplit(outArray() as integer, _ inArray() as integer, _ startIndex as integer, _ lastIndex as integer,_ iDiv as integer) as integer dim as integer splitPoint FOR i as integer=startIndex TO lastIndex splitPoint += inArray(i)...
Nov 05, 2018 23:45
Forum: General
Topic: How to grab escape-sequence keycodes?
Replies: 8
Views: 206

### Re: How to grab escape-sequence keycodes?

var hFile = FreeFile() Open Cons For Input As #hFile var aborted=false while aborted = false var ASingleChar = Input(1,hFile) if ASingleChar<>"" then if ASingleChar[0] = 1 then var TwoChars = Input(2,hFile) if TwoChars[0]=64 andalso TwoChars[1]=13 then print "F1 are pressed !" e...
Nov 05, 2018 23:24
Forum: General
Topic: Russian Sorting Halves Danilin
Replies: 11
Views: 273

### Re: Russian Sorting Halves Danilin

'RUSSIAN sorting halves 4 part bubble RANDOMIZE TIMER const as integer N = 17539 DIM as integer d(1 to N), a(1 to N), v(1 to N), q(1 to 5) FOR i as integer =1 TO N d(i)=INT(RND * N) NEXT print "DA RUS 4 start" dim as double start=TIMER dim as integer summa FOR i as integer=1 TO N summa +=...
Nov 05, 2018 22:35
Forum: General
Topic: How to grab escape-sequence keycodes?
Replies: 8
Views: 206

### Re: How to grab escape-sequence keycodes?

"... Inkey, Getkey, and Multikey ..."

What have this functions to do with a RS-232 connection ?

In FreeBASIC a RS-232 connection is like a file read / write operation.

/wiki/KeyPgOpenCom

Joshy
Nov 04, 2018 22:28
Forum: General
Topic: Illegal non-static member access
Replies: 16
Views: 244

### Re: Illegal non-static member access

Code: Select all

`type tEventHandler as sub()type TMenu : as tEventHandler clickhandler : end typetype TForm : as TMenu menu : end typesub MenuItemClick()   print "menu item 1"end subdim as TForm myFormmyForm.menu.clickhandler = @MenuItemClicksleep`

Go to advanced search