Function: Separate the integer part of the fractional part

Announce and discuss the progress of your various programming-related projects...programs, games, websites, tutorials, libraries...anything!

Moderators: Pete, Mods

Post Reply
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

Function: Separate the integer part of the fractional part

Post by lrcvs »

FUNCTION enterdec$ (v$, x$)
'Function: Separate the integer part of the fractional part without rounding.
'The X$ must be: E = integer <> D = decimal

'Funcion: Separa la parte entera de la parte decimal sin redondeos
'La x$ tiene que ser: E = entero <> D = decimal

x$ = UCASE$(x$)
FOR n = 1 TO LEN(v$)
z$ = MID$(v$, n, 1)
IF z$ = "." THEN w = 1
IF w = 0 THEN ent$ = ent$ + z$: lent = lent + 1
IF w = 1 THEN dec$ = dec$ + z$: ldec = ldec + 1
NEXT n
IF x$ = "E" THEN enterdec$ = ent$
IF x$ = "D" THEN enterdec$ = dec$
END FUNCTION
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Hmmmmmmmmmm.........

Post by burger2227 »

Code: Select all

FUNCTION IntegerOnly% (dec!)
decimal$ = LTRIM$(STR$(dec!))

FOR i = 1 to LEN(decimal$)
     Temp$ = MID$(decimal$, i, 1)
     IF Temp$ = "." THEN EXIT FOR
NEXT

IntegerOnly% = VAL(MID$(decimal$), 1, i - 1)

END FUNCTION 
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

To Burger 2227: Uuuuuuuuuuuuuuuummmmmmmmmmmmm!!!

Post by lrcvs »

Mr. Burger 2227:

First: No, I acknowledge having read the post you indicated.

Second: My conociments of computer are very low, not anything of "C", "C ++"...

My knowledge is limited to QBasic and other computer languages.

However this function is very simple, is pure coincidence the similarity with the post that you indicate.

Everything you put in posts, are creation itself, is pretty straightforward.

For example, this program and this is mine also in QbasicStation:

This procedure serves to eliminate letters and the decimal point

FUNCTION filtro$ (a$,b$)
'Este procedimiento sirve para eliminar letras y el punto decimal
'Variables:
'a$ : es lo que queremos filtrar
'b$ : es el patron que sirve de filtro
'z$, y$, c$ : acumuladores de caracteres / texto
'a, b : contadores posicionales
FOR a = 1 TO LEN(a$)
FOR b = 1 TO LEN(b$)
z$ = MID$(a$, a, 1)
y$ = MID$(b$, b, 1)
IF r$ = "A" AND ASC(z$) = ASC(y$) THEN c$ = c$ + y$
NEXT b
NEXT a
filtro$ = c$
END FUNCTION

This program you have seen on other occasions and it is made by me, is equally simple, both have the same style.

Greetings from Spain

Here a friend!!!
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Uuuuuhhhhhhhhmmmmm

Post by Mentat »

lrcvs wrote:Mr. Burger 2227:

First: No, I acknowledge having read the post you indicated.

Second: My conociments of computer are very low, not anything of "C", "C ++"...

My knowledge is limited to QBasic and other computer languages.

However this function is very simple, is pure coincidence the similarity with the post that you indicate.

Everything you put in posts, are creation itself, is pretty straightforward.

For example, this program and this is mine also in QbasicStation:

This procedure serves to eliminate letters and the decimal point

FUNCTION filtro$ (a$,b$)
'Este procedimiento sirve para eliminar letras y el punto decimal
'Variables:
'a$ : es lo que queremos filtrar
'b$ : es el patron que sirve de filtro
'z$, y$, c$ : acumuladores de caracteres / texto
'a, b : contadores posicionales
FOR a = 1 TO LEN(a$)
FOR b = 1 TO LEN(b$)
z$ = MID$(a$, a, 1)
y$ = MID$(b$, b, 1)
IF r$ = "A" AND ASC(z$) = ASC(y$) THEN c$ = c$ + y$
NEXT b
NEXT a
filtro$ = c$
END FUNCTION

This program you have seen on other occasions and it is made by me, is equally simple, both have the same style.

Greetings from Spain

Here a friend!!!
What Mr. Burger wrote was in QB. He just did some cleaning up and put code tags around them.

Likey like this:

Code: Select all

Here be coding dragons
For any grievances posted above, I blame whoever is in charge . . .
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

All this by a small and simple program.?

Post by lrcvs »

I do not understand :

1?) "Here be coding dragons"

2?) 9 + 9 = 12

3?) "Turn qb upside down and you'll see it"

All this by a small and simple program.?

I'am new here...!!!

Ah! Felicitys to the U.S. for your players of basketball and swimmers at the 2008 Olympics in Beijing.

Also to those of Australia for your swimmer.

Well, greetings.
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Re: All this by a small and simple program.?

Post by Mentat »

lrcvs wrote:I do not understand :

1?) "Here be coding dragons"

2?) 9 + 9 = 12

3?) "Turn qb upside down and you'll see it"

All this by a small and simple program.?

I'am new here...!!!

Ah! Felicitys to the U.S. for your players of basketball and swimmers at the 2008 Olympics in Beijing.

Also to those of Australia for your swimmer.

Well, greetings.
#1 was a joke. I was just showing how to use code tags, and I had to put something in there. So I used 'coding dragons'. 'Hello world' would have worked too.

#2 & #3 are part of my sig. You make it in your edit-profile page, and the forum automatically includes it at the bottom of all your posts. It's just something you put in that's funny, thought provocative, descriptive about you, or just anything.
For any grievances posted above, I blame whoever is in charge . . .
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

O.k.!!!

Post by lrcvs »

O.k.

Here a friend!!
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Post by sid6.7 »

ircvs

anything thats below that thin line near the bottom of a post
is part of a signature and has nothing to do with the rest of a POST...


I.E

its like writing a letter.....

and then signing it "yours truely, ircvs" at the end of your letter

it rarely has anything to do with the current post. ignore them...
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

I'am very thaknful !!!

Post by lrcvs »

Hi, sid6.7 :

I'am very thaknful !!!

Greetings from Spain
Post Reply