Thread: Drop lowest score?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428
    avg = sum(all grades)/numberofgrades

    Your teacher should have taught you an if statement by now. If not it looks like this
    Code:
    if(condition)
    {
      dosomething();
    }
    So you see if the score is lowest using operators

    < (less than)
    > (greater than)
    == (equal to)
    <= (lessthan or equal to)
    >= (greater than or equal to)

    Those are your tools you know you got this.

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Use std::sort() to sort from lowest to highest, then use std::accumulate() on all the scores except the first one, then divide by the number of scores - 1.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

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: 22
    Last Post: 11-13-2009, 05:51 PM
  3. trouble with creating a loop to read certain number of inputs
    By import tuner650 in forum C++ Programming
    Replies: 2
    Last Post: 03-20-2008, 07:28 PM
  4. Lowest Score Drop - C++
    By getName(C-Dub) in forum C++ Programming
    Replies: 4
    Last Post: 01-20-2008, 07:02 PM
  5. Lowest Score Drop
    By naya22 in forum C++ Programming
    Replies: 16
    Last Post: 04-29-2007, 12:48 AM