Results 1 to 18 of 18

Thread: fibinootchi numbers

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    12
    How would I write a program in VB that displays fibinootchi numbers?

    CorettaB

  2. #2
    Junior Member
    Join Date
    May 2000
    Posts
    17
    the C++ solution is as follows. You can easily convert this algorithm to VB code. This code specifically prints 5 numbers per line. Use an array where you see 'data'. I was using a vector declared as:

    vector <int> data; (same as data[i])

    Email me directly with further questions:

    [email protected]

    fibonacci(number)
    {
    for ( int i = 2; i < number; i++ )
    {
    if ( i > 1 )
    {
    if ( bolWritten == false )
    {
    printf("%12d%12d", data.at(0),data.at(1));
    bolWritten = true;
    intItemOnLine = 3;
    }

    data.push_back( data.at(i-1) + data.at(i - 2) );

    if ( intItemOnLine < 5 )
    {
    printf("%12d", data.at(i));
    intItemOnLine++;
    }
    else
    {
    printf("%12d\n", data.at(i));
    intItemOnLine = 1;
    }
    } // end if
    } // end for
    } // end function


  3. #3
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    I once wrote a program for doing that. Past this into notepad and save it as a .frm file:
    Code:
    VERSION 5.00
    Begin VB.Form Fibonacci 
       BorderStyle     =   3  'Fixed Dialog
       Caption         =   "Calculate fibonacci's with strings!"
       ClientHeight    =   24
       ClientLeft      =   48
       ClientTop       =   336
       ClientWidth     =   5388
       LinkTopic       =   "Form1"
       MaxButton       =   0   'False
       MinButton       =   0   'False
       ScaleHeight     =   24
       ScaleWidth      =   5388
       ShowInTaskbar   =   0   'False
       StartUpPosition =   3  'Windows Default
    End
    Attribute VB_Name = "Fibonacci"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Dim Running As Boolean
    
    Private Function Telop(Getal1 As String, Getal2 As String) As String
        'Getal2 is hier altijd > Getal1
        
        Dim Opslag As Integer
        Dim Uitkomst As String
        
        Opslag = 0
        Uitkomst = ""
        
        For i = 1 To Len(Getal2)
            If i <= Len(Getal1) Then
                Opslag = Opslag + CInt(Left(Right(Getal1, i), 1)) + _
                    CInt(Left(Right(Getal2, i), 1))
            Else
                Opslag = Opslag + CInt(Left(Right(Getal2, i), 1))
            End If
            
            If Opslag < 10 Then
                Uitkomst = Uitkomst & Opslag
                Opslag = 0
            Else
                Uitkomst = Uitkomst & Opslag Mod 10
                Opslag = (Opslag - (Opslag Mod 10)) / 10
            End If
            
            If i = Len(Getal2) And Opslag > 0 Then
                'Bak er een eind aan
                Uitkomst = Uitkomst & StrReverse(CStr(Opslag))
            End If
        Next
        
        Telop = StrReverse(Uitkomst)
    End Function
    
    Private Sub Form_Load()
        Running = True
        Dim Eerste As String
        Dim Tweede As String
        Dim Swap As String
        Dim Counter As String
        
        Eerste = 1
        Tweede = 2
        
        Open App.Path & "\fibonacci.txt" For Output As #1
            Print #1, "F1" & Chr(9) & Chr(9) & "=1"
            Print #1, "F2" & Chr(9) & Chr(9) & "=1"
            Counter = 3
            Me.Show
            Do
                Swap = Eerste
                DoEvents
                Eerste = Tweede
                DoEvents
                Tweede = Telop(Swap, Tweede)
                DoEvents
                Print #1, "F"; Counter & Chr(9) & Chr(9) & "=" & Tweede
                DoEvents
                Counter = Telop("1", Counter)
                Fibonacci.Caption = Counter & Chr(9) & Chr(9) & "Calculate fibonacci's with strings!"
            Loop While Running
        Close #1
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        Running = False
    End Sub
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    What the h*ll are fibinootchi numbers?
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  5. #5
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Yeah, who is fibinootchi anyway? Is he related to Fibonacci?

  6. #6
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    I have never heard of fibonootchi, but I think he means fibonacci.
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  7. #7
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Did the replies help you?
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  8. #8

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    12
    Originally posted by oetje
    Did the replies help you?

    Yes! the replies helped, even made me giggle.
    CorettaB

  9. #9

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    12
    Originally posted by coretta
    Originally posted by oetje
    Did the replies help you?

    Yes! the replies helped, even made me giggle.
    CorettaB

  10. #10
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    But who/what is fibonacci ?
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  11. #11
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Jop this site tells things about Fibonacci:http://www-groups.dcs.st-and.ac.uk/~...Fibonacci.html
    Hey, I just found a site that has a vb program that can draw pictures of fibonacci numbers.http://www.moonstar.com/~nedmay/chromat/fibonaci.htm
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  12. #12

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    12
    [QUOTE]Originally posted by oetje
    Jop this site tells things about Fibonacci:http://www-groups.dcs.st-and.ac.uk/~...Fibonacci.html
    Hey, I just found a site that has a vb program that can draw pictures of fibonacci numbers.http://www.moonstar.com/~nedmay/chromat/fibonaci.htm

    [/QUOTE cool website! how did you ever find the site? thank!It explains more about fibonacci.



    CorettaB

  13. #13

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    12
    [QUOTE]Originally posted by coretta
    Originally posted by oetje
    Jop this site tells things about Fibonacci:http://www-groups.dcs.st-and.ac.uk/~...Fibonacci.html
    Hey, I just found a site that has a vb program that can draw pictures of fibonacci numbers.http://www.moonstar.com/~nedmay/chromat/fibonaci.htm

    [/QUOTE cool website! how did you ever find the site? thank!It explains more about fibonacci.


    CorettaB

  14. #14

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    12
    [QUOTE]Originally posted by coretta
    Originally posted by coretta
    Originally posted by oetje
    Jop this site tells things about Fibonacci:http://www-groups.dcs.st-and.ac.uk/~...Fibonacci.html
    Hey, I just found a site that has a vb program that can draw pictures of fibonacci numbers.http://www.moonstar.com/~nedmay/chromat/fibonaci.htm

    [/QUOTE


    Cool website! how did you ever find the site? Thanks! It explains more about fibonacci.


    CorettaB

  15. #15

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    12
    [QUOTE]Originally posted by coretta
    Originally posted by coretta
    Originally posted by coretta
    Originally posted by oetje
    Jop this site tells things about Fibonacci:http://www-groups.dcs.st-and.ac.uk/~...Fibonacci.html
    Hey, I just found a site that has a vb program that can draw pictures of fibonacci numbers.http://www.moonstar.com/~nedmay/chromat/fibonaci.htm

    [/QUOTE


    Cool website! how did you ever find the site? It explains more about fibonacci.

    Thanks


    CorettaB

  16. #16
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Coretta, I just typed "fibonacci" into Altavista...
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  17. #17

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    12
    Originally posted by oetje
    Coretta, I just typed "fibonacci" into Altavista...
    Thank you for showing me the way. I have to get back to work now! Chat with you later.
    CorettaB

  18. #18
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Coretta, I'm sorry but what are you doing?
    Oetje, thanx for the sites!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width