Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old January 17th, 2008, 10:47 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did state it, it says what the functions so in the first post, i understand what the function does to top but i dont know what they do to anArray.

Reply With Quote
  #12 (permalink)  
Old January 17th, 2008, 11:04 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Put store the value in the array at position top.. so if you pass top=1 and char = "X" will store X at position 2 of the array..

ok?

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
  #13 (permalink)  
Old January 17th, 2008, 11:05 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey, i have completed the there tables for each input string, will you check if they are right for me please?

http://www.imagehosting.com/out.php/i1515670_cd.bmp


http://www.imagehosting.com/out.php/...2_untitled.JPG


http://www.imagehosting.com/out.php/..._untitled2.JPG

thanks!

Reply With Quote
  #14 (permalink)  
Old January 17th, 2008, 11:09 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. I can't check if they are correct or wrong.. but glad you could sort this thing out...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
  #15 (permalink)  
Old January 17th, 2008, 11:13 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oh ok then. i dont think its all right, i might have done some of the procedures wrong.

Reply With Quote
  #16 (permalink)  
Old January 17th, 2008, 11:15 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Well.. doing things the wrong way is part of learning too...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
  #17 (permalink)  
Old January 17th, 2008, 11:33 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ye i know but having the right answer will help alot so i can go back and check where i went wrong and figure out why i went wrong.

Reply With Quote
  #18 (permalink)  
Old January 17th, 2008, 03:44 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I presumed that these functions for Push and Pop already existed, and that you only had to use them.

Fortunately, because you can find out the status of an array, you don't need to do thing in as complex a fashion as you would if you were working in a lower-level environment.

Tp push a value onto an array, you obtain the index of the top item, add a new item to the array (that is, expand it's size by one), then add the data to that element (that is, set that new element to the value of the data).
Code:
    Dim i As Integer
        i = UBound(MyArray)
    Redim Preserve MyArray(1 to i + 1)  ' Preserve is nec. to keep 
                                          the existing values.
    MyArray(i + 1) = MyNewValue
    If you wrap all this in a routine named Push(), you can either make it a Function, returning the new size of the array, or just a Sub that handles the action details, being called from one, simple, self documenting line: Push NewValue, MyArray.

Pulling a value off the array can be done exactly the same, except you read the value at the UBound() position, then ReDim the array i - 1.

Because VB maintains UBound and LBound, you do not need to increment or decrement any variables and maintain them to keep track of what the status of your array is.

If you are working with strings, you can make this even simpler. The pushing of a value onto the end of the string is just:
Code:
    MyString = MyString & MyNewChar
The string will be expanded by 1 for you, if MyNewChar is just one character in size.

The Pop procedure would be a little more complex, but only a little:
Code:
    Dim Temp As String * 1       ' Creates a 1-character, fixed-length string
    Temp = Right$(MyString, 1)   ' Get the right-most character's value.
    MyString = Left$(MyString, Len(MyString) - 1)   ' Shorten the string by 1
Reply With Quote
  #19 (permalink)  
Old February 5th, 2008, 07:15 AM
Registered User
 
Join Date: Feb 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank You,

http://www.searchfinish.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
apriori algorithm iralala J2EE 4 January 1st, 2014 06:49 PM
FTC algorithm iralala Java Databases 1 February 3rd, 2009 07:57 AM
algorithm angelboy Other Programming Languages 0 April 14th, 2007 08:56 AM
Typical Algorithm rajanikrishna ASP.NET 1.0 and 1.1 Professional 0 November 20th, 2006 03:05 AM
Algorithm kvanchi General .NET 3 January 20th, 2005 05:28 AM



All times are GMT -4. The time now is 03:44 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.