Thread: Noob Question....Any help appreciated

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User RandomX's Avatar
    Join Date
    Nov 2006
    Posts
    19
    yes that is what Im thinking. So, then my algorithm for this would be just a series of

    if variable is less than previous variable,
    then move onto the next variable

    It would keep doing that until it got to the comparison between 4 and 5 (this is assuming I start at -5). With the pattern Im going, the numbers keep decreasing until it reaches its lowest point of 4, then when it gets to 5 the value is larger than the previous. at this point it might looking something like this:

    if variable is less than previous variable,
    then move onto the next variable
    else this variable is the minimum point


    Do you follow what Im saying?

  2. #2
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Psuedocode:
    Code:
    int num1, num2;
    for (int i = -5; i <= 5; i++)
    {
        num1 = getalgo(i);  
        if (num1 < num2)
        {
              num2 = num1;
        }
    }
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another noob question
    By clb2003 in forum C Programming
    Replies: 4
    Last Post: 02-12-2009, 01:28 PM
  2. Noob printf question
    By lolguy in forum C Programming
    Replies: 3
    Last Post: 12-14-2008, 08:08 PM
  3. Noob question (redeclaring a array)
    By Demon.killer in forum C Programming
    Replies: 8
    Last Post: 10-21-2006, 12:06 PM
  4. Noob question - Implementing INI Parsing class
    By Highland Laddie in forum C++ Programming
    Replies: 2
    Last Post: 07-04-2005, 05:47 PM
  5. Replies: 5
    Last Post: 11-01-2002, 06:09 PM