The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > General Programming > Visual Basic


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags:

Closed Thread
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 06-10-2007, 04:42 PM
Pipo P
Posts: n/a
[SOLVED] Can anybody help me with this Program in Visual Basic, please !!?

Part #1:
ASCII art has been around for quite some time. In the 60s and 70s, programmers of mainframe computers used the computers during downtime to generate posters and pictures. The task is to create a program which draws a simple shape-- triangle.
*
**
***
****
*****
****
***
**
*
REQUIREMENTS: Use loop(s) to draw the shape.
Print one character at the time. One character per loop iteration.
Receive the size of the triangle from the the user through a texbox. ( Valid user input is 5,6,7,8 )
The number received will be the largest horizontal point in the triangle.
The program should be able to create different sizes of triangles, based upon user input.
Provide error cheking to make sure the user input is in the range of 5 to 8.
Do not use any arrays in this program. Use modular program design. Use procedures and/or fuctions for all modules and incorporate "pass by reference" between modules.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #2 (permalink)  
Old 06-25-2007, 10:18 PM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 308
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
Here's a byref function i just made for yah Validates must be 5-8, passes integer byref, no arrays used, just iterations over a value.

Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MsgBox(BuildTriangle(9))
    End Sub

    Public Function BuildTriangle(ByRef MaxAmt As Integer) As String

        ' Initial Counter for Inner Loop, and Iterators, and Return Value
        Dim Counter As Integer = 0, _
            X As Integer, _
            Y As Integer, _
            RetVal As String = ""

        If (MaxAmt < 9) And (MaxAmt > 4) Then
            ' Build the incrementing portion of the triangle
            For X = 1 To MaxAmt
                Counter += 1
                For Y = 1 To Counter
                    RetVal &= "*"
                Next
                RetVal &= vbCrLf
            Next

            ' Build the decrementing portion of the triangle
            For X = 1 To MaxAmt - 1
                Counter -= 1
                For Y = 1 To Counter
                    RetVal &= "*"
                Next
                RetVal &= vbCrLf
            Next
        Else
            RetVal = "Please enter a value between 5 and 8"
        End If

        ' Return the str
        Return RetVal

    End Function

End Class
Closed Thread


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 02:35 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50