Loopedy Loop - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Loopedy Loop

WannaBWannaB Posts: 23Member
I am trying to figure out the code to creating an image on a screen using loops. EX: Some emails are sent with pictures of bears, flowers, heart, etc. I want it to include user input. I have the input printing to the screen , but I cannot figure out how the loop is supposed to be coded to create the shape. I want to create a circle using the user's input.

Comments

  • JomacJomac Posts: 231Member
    Copy this function into your module and call it passing the prooper values.

    [code]
    Private Sub DrawCircle(ByVal obj As Object, ByVal cx As Single, ByVal cy As Single, ByVal radius As Single, ByVal num_segments As Integer)
    Const PI = 3.14159265

    Dim X As Single
    Dim Y As Single
    Dim theta As Single
    Dim dtheta As Single
    Dim seg As Integer

    dtheta = 2 * PI / num_segments
    obj.CurrentX = cx + radius
    obj.CurrentY = cy
    theta = 0
    For seg = 1 To num_segments
    theta = theta + dtheta
    obj.Line -(cx + radius * Cos(theta), cy + radius * Sin(theta))
    Next seg
    End Sub
    [/code]

    Regards,
    ______
    [size=2][b][blue]J[/blue]omac.[/b][/size]

  • WannaBWannaB Posts: 23Member
    OK, here is the problem with my program: I am writing a program that is supposed to print a triangle on the screen from a character that the user inputs. There is also a limit to the number of lines that I want to appear. So far, I can get the character to appear on the screen, but I can't make it continue to the next line with an additional character on each line to form the triangle. Can anyone help me?
  • JomacJomac Posts: 231Member
    : OK, here is the problem with my program: I am writing a program that is supposed to print a triangle on the screen from a character that the user inputs. There is also a limit to the number of lines that I want to appear. So far, I can get the character to appear on the screen, but I can't make it continue to the next line with an additional character on each line to form the triangle. Can anyone help me?
    :


    Uh-Humm, your previous post asked how to create a CIRCLE.
Sign In or Register to comment.