Thread: Help with Loop

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    41

    Help with Loop

    I want to make these functions loop 5 times. Any suggestions on how. this is what i have.Currrebtly it just keeps looping.
    Code:
    int main(void)
    {
            int i;
            char letter;
            int sum = 0;
    
    for (i = 0; 1 < 2; i++)  
    {    
            int value = getGradeValue(0,110);
            letter = makeLetterGrade(&value);
            sum += value;
            displayGrade(value, sum, letter);
    }  
            return EXIT_SUCCESS;
    }

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by marquis1431 View Post
    I want to make these functions loop 5 times. Any suggestions on how. this is what i have.Currrebtly it just keeps looping.
    Code:
    int main(void)
    {
            int i;
            char letter;
            int sum = 0;
    
    for (i = 0; 1 < 2; i++)  
    {    
            int value = getGradeValue(0,110);
            letter = makeLetterGrade(&value);
            sum += value;
            displayGrade(value, sum, letter);
    }  
            return EXIT_SUCCESS;
    }
    There's not anything in your loop (or anything you could put in your loop) that could make 1 not less than 2. Maybe you should change that.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    41
    Rookie mistake typo...thanks tabstop

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. nested loop, simple but i'm missing it
    By big_brother in forum C Programming
    Replies: 19
    Last Post: 10-23-2006, 10:21 PM
  2. While loop misbehaving (or misunderstanding)
    By mattAU in forum C Programming
    Replies: 2
    Last Post: 08-28-2006, 02:14 AM
  3. loop in a linked linked lists
    By kris.c in forum C Programming
    Replies: 6
    Last Post: 08-26-2006, 12:38 PM
  4. while loop help
    By bliznags in forum C Programming
    Replies: 5
    Last Post: 03-20-2005, 12:30 AM
  5. loop issues
    By kristy in forum C Programming
    Replies: 3
    Last Post: 03-05-2005, 09:14 AM