• Print

Author Topic: Tutorial on Arrays by T Richie  (Read 380 times)

OlDosLover

  • Hero Member
  • *****
  • Posts: 3919
  • OlDosLover
    • Email
Tutorial on Arrays by T Richie
« on: March 26, 2013, 10:59:22 PM »
Hi all,
    I wanted to start a topic on this so other (me too) can comment. I think this is a piece of excellent work and definetly needs expanding on those last topic REDIM , PRESERVE , etc. Well written , simple to grasp and illustrated concisely. Well done Terry!
OlDosLover.

JustinRichardsMusic

  • Sr. Member
  • ****
  • Posts: 347
  • Character names can be found in metal from the 90s
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #1 on: March 26, 2013, 11:24:45 PM »
I also read the entire tutorial and found it extremely easy to understand and I imagine it would provide a wealth of information for new programmers...  and me as I've never used multi-dimensional arrays before either  ;D

Thank you Terrie, you sound like a great teacher.  Your students are fortunate to have you I think  :D

And thanks ODL for starting this topic to comment the tutorial as well... I get the reason why we can't post comments on the tutorial itself so I guess starting a new topic is the only way to do it!

Cheers
Justin
James Hetter's Revenge has been unleashed! Follow the games progress here:
http://www.qb64.net/forum/index.php?topic=6762.0

Download the latest version here:
https://www.dropbox.com/s/8p8gguliw1y6ink/Hetters%20Revenge.zip?m

Galleon

  • Administrator
  • Hero Member
  • *****
  • Posts: 4679
  • QB Forever
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #2 on: March 27, 2013, 05:59:16 AM »
I skimmed the tutorial and agree, great job. 8)
Something old... Something new... Something borrowed... Something blue...

TerryRitchie

  • Hero Member
  • *****
  • Posts: 2269
  • FORMAT C:\ /Q /U /AUTOTEST (How to repair Win8)
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #3 on: March 27, 2013, 06:07:22 AM »
Thanks guys :)

I have decided to continue on with the remaining topics because of this thread and a few emails I have already received. I have a four day weekend (spring break) so I should have the remainder finished by Saturday or Sunday.

codeguy

  • Hero Member
  • *****
  • Posts: 3555
  • what the h3ll did i name that code?
    • stuff at dkm
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #4 on: March 28, 2013, 08:47:19 AM »
nice work, your work is always top-notch and well-written. ;D
http://denteddisk.forums-free.com/make-an-appointment-with-the-resident-code-guru-f34.html

TerryRitchie

  • Hero Member
  • *****
  • Posts: 2269
  • FORMAT C:\ /Q /U /AUTOTEST (How to repair Win8)
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #5 on: March 30, 2013, 11:03:39 AM »
As promised, the array tutorial in the tutorials section has been updated.

wiggins

  • Jr. Member
  • **
  • Posts: 53
Re: Tutorial on Arrays by T Richie
« Reply #6 on: March 30, 2013, 04:55:40 PM »
I found the tutorial to be very helpful.  Thank you for taking the time to share it with us.

OlDosLover

  • Hero Member
  • *****
  • Posts: 3919
  • OlDosLover
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #7 on: March 30, 2013, 10:38:49 PM »
Hi all,
    Complete and comprehensive , a very good tutorial Terry. The only critismn i have is there is no video! Thanks
OlDosLover.

small no more

  • Sr. Member
  • ****
  • Posts: 256
  • Ask and you will receive, Seek and you will find
    • not launched
Re: Tutorial on Arrays by T Richie
« Reply #8 on: March 30, 2013, 11:23:26 PM »
Terry,


in your tutorial on arrays in this example

Code: [Select]
DIM Contacts$(3, 5)
DIM Match%
DIM Count%

_TITLE "Array tutorial - snippet2.bas"

Contacts$(1, 1) = "Mike Smith"
Contacts$(1, 2) = "123 Any Street"
Contacts$(1, 3) = "Anytown"
Contacts$(1, 4) = "OH"
Contacts$(1, 5) = "12345"
Contacts$(2, 1) = "Laura Flowers"
Contacts$(2, 2) = "456 This Street"
Contacts$(2, 3) = "Toledo"
Contacts$(2, 4) = "MA"
Contacts$(2, 5) = "23432"
Contacts$(3, 1) = "Tom Thumb"
Contacts$(3, 2) = "765 My Street"
Contacts$(3, 3) = "Mayberry"
Contacts$(3, 4) = "NC"
Contacts$(3, 5) = "24241"

DO
    INPUT "Enter a name or partial name to search for: ", n$
    IF n$ = "" THEN END
    Count% = 1
    DO
        IF INSTR(UCASE$(Contacts$(Count%, 1)), UCASE$(n$)) THEN
            Match% = Count%
            EXIT DO
        END IF
        Count% = Count% + 1
    LOOP UNTIL Count% = 4
    IF Match% THEN
        PRINT "Match found:"
        PRINT
        PRINT "Name   : "; Contacts$(Match%, 1)
        PRINT "Address: "; Contacts$(Match%, 2)
        PRINT "City   : "; Contacts$(Match%, 3)
        PRINT "State  : "; Contacts$(Match%, 4)
        PRINT "Zip    : "; Contacts$(Match%, 5)
        Match% = 0
    ELSE
        PRINT "Match not found"
    END IF
LOOP


How would you do this without hard coding the data in to the program, like reading it from a file. I have tried to figure it out with no luck.
A good teacher must be able to put himself in the place of those who find learning hard.


                                           Eliphas Levi

Galleon

  • Administrator
  • Hero Member
  • *****
  • Posts: 4679
  • QB Forever
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #9 on: March 31, 2013, 01:33:48 AM »
Code: [Select]
REDIM Contacts(100, 5) AS STRING
OPEN "whatever.txt" FOR INPUT AS #1
n = 0
DO UNTIL EOF(1)
    n = n + 1
    FOR i = 1 TO 5
        LINE INPUT #1, Contacts$(n, i)
    NEXT
LOOP
CLOSE #1
Something old... Something new... Something borrowed... Something blue...

Billbo

  • Sr. Member
  • ****
  • Posts: 294
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #10 on: March 31, 2013, 07:07:29 AM »
Terry,

I'm very impressed with your tutorial. With it, and Galleon's last reply, I'll
start the conversion of my 'Distance and Bearing' program.

Great work.

Bill

TerryRitchie

  • Hero Member
  • *****
  • Posts: 2269
  • FORMAT C:\ /Q /U /AUTOTEST (How to repair Win8)
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #11 on: March 31, 2013, 08:52:17 AM »
Small no more: In the tutorial is an example of a phone book that obtains the information from a file (snippet7.pho). That should give you an idea.

codeguy

  • Hero Member
  • *****
  • Posts: 3555
  • what the h3ll did i name that code?
    • stuff at dkm
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #12 on: April 02, 2013, 07:58:52 AM »
a 4-dimensional array would be like hours (time) within a day within a month within a year, sorta like a scheduling program. yep, that's a practical example of a 4-dimensional array. that would be easy enough to demonstrate as a spreadsheet example.
http://denteddisk.forums-free.com/make-an-appointment-with-the-resident-code-guru-f34.html

Amaysim

  • Newbie
  • *
  • Posts: 38
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #13 on: April 04, 2013, 01:48:30 PM »
Really good tutorial i learnt many thing thanks Mr Terry.

TerryRitchie

  • Hero Member
  • *****
  • Posts: 2269
  • FORMAT C:\ /Q /U /AUTOTEST (How to repair Win8)
    • Email
Re: Tutorial on Arrays by T Richie
« Reply #14 on: April 04, 2013, 03:00:41 PM »
Quote from: Amaysim on April 04, 2013, 01:48:30 PM
Really good tutorial i learnt many thing thanks Mr Terry.

Glad I could help :)

If you don't mind me asking, what specifically did you gain from the tutorial that helped clarify arrays? This information may help me to isolate key points when I teach this subject again in the fall.

  • Print