Results 1 to 1 of 1

Thread: Excercise: #1, Section 3.2 (page 21), Super-D Numbers

  1. #1
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Excercise: #1, Section 3.2 (page 21), Super-D Numbers

    [code=thinbasic]' Example 3.2 Super-D Numbers

    ' From Stan Blank's Book:
    ' "Python Programming in OpenGL
    ' "A Graphical Approach to Programming

    ' Converted by Kent Sarikaya
    ' Last modified: February 25, 2010


    ' Since this is a console app, need to use the Console Module
    ' The string and other features used are part of the core module
    ' so no need to use any other Uses modules
    Uses "Console"

    ' Uncomment the next line if you want to run in fullscreen mode
    'Console_FullScreen()

    ' We can use Aliases in thinBasic
    ' now Input can be used as Console_Read
    Alias Console_Read As Input

    ' The long type was not big enough, so I used quad
    Dim i, n, x, d As Quad

    PrintL("Super-D fun!")
    PrintL("For example: 4 - this will be any D^4 * 4 which contains 4444")
    PrintL("Another example: 2 - this will be any D^2 * 2 which contains 22")

    Print("Please enter the number for Super-D: ")
    d = Val(Input())

    Print("Please enter the upper bound: ")
    i = Val(Input())

    For n = 1 To i
    x = d*n^d
    If InStr(Str$(x),Repeat$(d,TrimFull$(Str$(d)))) Then PrintL( n + " " + x )
    Next

    Print("Finished - press any key to exit")
    WaitKey


    'Based on exercise 1 - pg.21[/code]
    Attached Files Attached Files
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. Example: Section 3.2 (page 14), Super-3 Numbers
    By kryton9 in forum ThinBASIC programming in OpenGL/TBGL
    Replies: 0
    Last Post: 25-02-2010, 09:52

Members who have read this thread: 1

Posting Permissions

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