Like Tree1Likes
  • 1 Post By quzah

Print numbers within a certain range of an Array

This is a discussion on Print numbers within a certain range of an Array within the C Programming forums, part of the General Programming Boards category; I am trying to find the grades between certain numbers and then display them. I have the inputs set up ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    5

    Print numbers within a certain range of an Array

    I am trying to find the grades between certain numbers and then display them.

    I have the inputs set up to get the min and max, but I dont know how to get the printf/loop to display what I want.
    Last edited by omegasli; 04-10-2011 at 02:06 AM.

  2. #2
    Registered User
    Join Date
    Apr 2011
    Posts
    5
    Please come through for me! Someone has to know it!
    Last edited by omegasli; 04-10-2011 at 01:50 AM.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    > *grades >= min && *grades <= max
    You want this as an if statement inside your loop, not a condition for continuing the loop.

    Also, what is grades, and why are you incrementing it?
    Just use grades[i] to index it (whether it's a pointer or an array)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Apr 2011
    Posts
    5
    Quote Originally Posted by Salem View Post
    > *grades >= min && *grades <= max
    You want this as an if statement inside your loop, not a condition for continuing the loop.

    Also, what is grades, and why are you incrementing it?
    Just use grades[i] to index it (whether it's a pointer or an array)
    Thank you SO MUCH.

    You are literally a lifesaver. This program has been quite a mess. Your info made it so I can finally be done with it.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by omegasli View Post
    You are literally a lifesaver.
    You should find a different school or job if they are threatening your life if you can't learn C.

    Quzah.
    zbred likes this.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Generate numbers with a range and store to file.
    By carbonr in forum C++ Programming
    Replies: 9
    Last Post: 07-27-2010, 01:50 PM
  2. using rand() to create a range of numbers
    By keira in forum C Programming
    Replies: 7
    Last Post: 09-11-2007, 02:45 AM
  3. Random Numbers within a range OTHER than 1-X
    By Kaelin in forum C++ Programming
    Replies: 11
    Last Post: 02-16-2005, 11:57 AM
  4. Replies: 10
    Last Post: 11-23-2001, 10:01 AM
  5. generating random numbers within a range
    By tucky in forum C Programming
    Replies: 3
    Last Post: 09-14-2001, 01:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21