Thread: Displaying highest and lowest values

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    1

    Displaying highest and lowest values

    Hello i'm very new too C++

    But I basically need to know how to write a simple small program that displays the highest value and lowest value of a string of user inputted digits. I think its if else's but to be honets i'm completly lost! Can anyone help me out please?

    Thankyou!

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Keep variables which store highest and lowest values.

    Loop through each entry and check if it's higher than the previous recorded highest, or lower than the previous recorded lowest.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What have you tried so far? Note the policy on homework.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Dec 2005
    Posts
    155
    Quote Originally Posted by laserlight
    What have you tried so far? Note the policy on homework.
    LOL, it could be homework, but doesnt mean we cant help him. Just you'll have to still do the work.... http://www.cppreference.com/cppstring/index.html is a site I found a long time ago about strings you can check out. It will help you get you started and then do what Cat said after you understand what your looking at. Hope that helps.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extracting lowest and highest score from array
    By sjalesho in forum C Programming
    Replies: 6
    Last Post: 03-01-2011, 06:24 PM
  2. Replies: 3
    Last Post: 02-22-2009, 02:54 PM
  3. Sorting an int array highest to lowest
    By switchback in forum C Programming
    Replies: 3
    Last Post: 07-27-2008, 03:30 AM
  4. Trying to sort numbers from lowest to highest
    By jw232 in forum C++ Programming
    Replies: 21
    Last Post: 01-21-2008, 04:03 PM
  5. did i do this right?
    By Joldil in forum C++ Programming
    Replies: 8
    Last Post: 07-25-2007, 02:43 AM