Shop OBEX P1 Docs P2 Docs Learn Events
Problem writing a program — Parallax Forums

Problem writing a program

HillsHills Posts: 13
edited 2004-11-24 00:21 in BASIC Stamp
Hi

I have a problem writing a program with Basic Stamp Editor Software.
I need a program who can search the smallest number in a group·of numbers or expressions. For example: the·smallest number in this array is p(2)=5

p·· var··Nib
p(0)=15
·p(1)=10·
············ p(2)=5·············

Could you guys please help me·by solving my problem and by giving me the program·in the BASIC STAMP FORUM·or·in my email:
····· pjosehills@hotmail.com

Remember that if it's impossible to search the smallest number·or expession·in an array, I would be very happy with a program who can search the smalest number or expression·in a group of numbers. For example :·with the command LOOKDOWN.

Post Edited (Hills) : 11/23/2004 11:13:21 PM GMT

Comments

  • K de JongK de Jong Posts: 154
    edited 2004-11-24 00:03
    Hi'

    To make it easy to start with I will assume the number of elements in your array is known.

    You can then do the following:

    Give the variable 'minimum' a value you expect to be larger then the smallest item in your array.


    FOR CountVal=0 TO CountVal=ArraySize

    IF P(CountVal)<minimum THEN minimum=P(CountVal)

    NEXT


    This should work ffor a start

    Klaus
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-11-24 00:21
    Homework, eh?
Sign In or Register to comment.