Search found 574 matches
- Aug 25, 2023 4:17
- Forum: Sources, Examples, Tips and Tricks
- Topic: The Traveling Salesman Problem
- Replies: 0
- Views: 1325
The Traveling Salesman Problem
'THE TRAVELING SALESMAN PROBLEM CLS DIM AS INTEGER ia,ib,ic,id,ie,ig,ih,ii,ij,ik,il,im,in DIM AS DOUBLE db 'ia: number of points 'ib: coord X traveler 'ic: coord Y traveler 'id: for/next variable of the number of points 'ie: x2 coordinate of the rest of the points 'ig: y2 coordinate of the rest of ...
- Dec 18, 2021 16:54
- Forum: Sources, Examples, Tips and Tricks
- Topic: Simple program to capitalize a txt file.
- Replies: 0
- Views: 2391
Simple program to capitalize a txt file.
'Simple program to capitalize a txt file. 'The simple program capitalizes the first character after a period / dot / point DIM AS STRING sa,sb,sc,sd DIM AS INTEGER ib,ic,id CLS INPUT "file.ext: ";sa CLS OPEN sa FOR INPUT AS #1 WHILE NOT EOF (1) LINE INPUT #1,sc id = LEN(sc) sd=""...
- May 02, 2020 9:42
- Forum: General
- Topic: Remove duplicates (Only numbers)
- Replies: 0
- Views: 1326
Remove duplicates (Only numbers)
'Experiment # 1: Remove duplicates 'In this experiment, we only use an array 'ONLY NUMBERS!!! DECLARE SUB remove_duplicates(d() AS STRING) DIM AS INTEGER n,x RANDOMIZE ,3 x = 999 DIM d(x+1) AS STRING FOR n = 1 TO x+1 d(n) = LTRIM(STR(INT(RND*2000))) 'print d(n);" "; 'show numbers NEXT n PR...
- Mar 27, 2020 6:18
- Forum: General
- Topic: Ask about "new" and "delete"
- Replies: 5
- Views: 1009
Re: Ask about "new" and "delete"
Hi, all:
Ok, thanks everyone!
Cheers
Ok, thanks everyone!
Cheers
- Mar 26, 2020 22:27
- Forum: General
- Topic: Ask about "new" and "delete"
- Replies: 5
- Views: 1009
Re: Ask about "new" and "delete"
Hi, paul doe:
ok, thanks for your explanation
it is my mistake of interpretation.
Cheers
ok, thanks for your explanation
it is my mistake of interpretation.
Cheers
- Mar 26, 2020 21:50
- Forum: General
- Topic: Ask about "new" and "delete"
- Replies: 5
- Views: 1009
Ask about "new" and "delete"
Hi, all: My question is about "delete". According to the manual, "delete" deletes the portion of memory created by "new". According to my example, there are values that are not removed, they are still in memory. The operation of "delete" is correct? CLS 'We as...
- Mar 21, 2020 10:06
- Forum: General
- Topic: Program to calculate the GCD of more than two numbers
- Replies: 6
- Views: 1260
Re: Program to calculate the GCD of more than two numbers
Hi, all: DANGER !!! MY PROGRAM HAS AN ERROR !!! The variable: "e = 0" <<<< ERROR !!! It should say: "e = 1" <<< OK! Example error: How many numbers = 5 Numbers: 8888888 - 444444 - 22222 - 4422 - 88 Show: "1" <<< ERROR !!! It should show: "2" <<< Ok! This is th...
- Mar 21, 2020 8:08
- Forum: General
- Topic: Program to calculate the GCD of more than two numbers
- Replies: 6
- Views: 1260
Re: Program to calculate the GCD of more than two numbers
Hi, all: It had been a while since I programmed and yesterday a child asked me how to solve a GCD with more than 2 numbers. I got inspiration from that little program, I did it and it worked. Search Rosetta Code and the Freebasic forum to see if there was something similar and I couldn't find it. I ...
- Mar 20, 2020 16:30
- Forum: General
- Topic: Program to calculate the GCD of more than two numbers
- Replies: 6
- Views: 1260
Program to calculate the GCD of more than two numbers
'Program to find only the greatest common divisor of more than two numbers (Only for relatively small numbers) 'Examples: '3567-370968 = 3567 '720-2600 = 40 '4680-7200-16200 = 360 'Program to find only the greatest common divisor DIM AS INTEGER a,b,c,d,e,f,g,k,l CLS INPUT "How many numbers? (2,...
- Jul 22, 2019 5:35
- Forum: General
- Topic: Remove elements repeted
- Replies: 26
- Views: 10176
Re: Remove elements repeted
Hi, fxm:
As always, thank you for your observations.
Apologies
As always, thank you for your observations.
Apologies
- Jul 22, 2019 5:23
- Forum: General
- Topic: Remove elements repeted
- Replies: 26
- Views: 10176
Re: Remove elements repeted
'lrcvs 2019.jul.21 'program to eliminate repeated elements in an array. '1) we sort the initial array, using quicksort. '2) we remove the repeated elements, skipping the ones that are the same 'and reducing the time of "cleaning the repeated elements". '3)It is a small improvement of the ...
- Nov 25, 2017 20:37
- Forum: General
- Topic: QuickSort Text
- Replies: 3
- Views: 979
Re: QuickSort Text
Deleted, it does not work well.
Apologies.
Apologies.
- Nov 25, 2017 8:53
- Forum: General
- Topic: QuickSort Text
- Replies: 3
- Views: 979
QuickSort Text
Deleted, it does not work well.
Apologies.
Apologies.
- Nov 06, 2017 5:33
- Forum: General
- Topic: Remove elements repeted
- Replies: 26
- Views: 10176
Re: Remove elements repeted
Hi: Part # 2: With the previous program, we obtain the unique elements of a list / array (or remove the repeated ones.) Now, we show the original list / array, without the repeated elements and in the initial order. 'lrcvs 01.10.17 'program to eliminate repeated elements in an array. '1) we sort the...
- Nov 05, 2017 12:19
- Forum: General
- Topic: Remove elements repeted
- Replies: 26
- Views: 10176
Re: Remove elements repeted
Hi, fxm: Thank you very much for your observation. I modify the program with your indications. 'lrcvs 01.10.17 'Program to eliminate repeated elements in an array. '1) we sort the initial array, using quicksort. '2) we remove the repeated elements, skipping the ones that are the same 'and reducing t...