Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36
  1. #1

    Exclamation to all programmers out there... I NEED HELP XD


    yo! nid help on this..
    i'm still a newbie in this kind of business..
    i want to see how you make a code out of this and compare it to my own..
    or i can send you a copy of my code and correct it for my benefit XD..
    just reply to this post with your e.mail!
    thanks!

    C/C++..... nid help! XD

    here's the prob anyways....

    Write a program that reads 7 scores as input and outputs the average. The program uses an array of floats. Note that you need to determine the highest and the lowest score and exclude them in the computation, assume that there are no judges giving the same score.

    list of scores that the judges give:
    9.20
    9.00
    8.75
    9.40
    9.50
    8.90
    9.60

    /* you can use functions on this */

    /* the output would similarly look like this */

    Enter the 7 scores: 9.20 9.00 8.75 9.40 9.50 8.90 9.60

    Highest score: 9.60

    Lowest score: 8.75

    Average score: 9.20

  2. #2
    your just being lazy, why did you even take up CS/IT if you dont like solving problems?.

    that like what you learn in gradeschool adding averaging numbers.

    remember this is the fundamental concepts you'll need to learn if you want to survive in the real world LOL LOL

  3. #3
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    and here comes with 2 post... OMG.... ^^ what a day hahehhehehehe

  4. #4
    I can do this but using PHP T_T. I tried C++ b4 but t'was a very long time ago . Ok lang ang PHP? But anyways the logic will be like this.


    PHP Code:
    $arrayinputs = array(9.209.008.759.409.508.909.60); // given inputs

    $size count($arrayinputs);  // count the number of elements.

    // initialize some variables.

    $elementholder 0

    $average 0.0;

    $lowest 0;

    $highest 0;

    // use loop to process each elements of $arrayinputs.

    for ( $i=0$i<$size$i++) {

        if(
    $i==0){

            
    // inialized the first max and min.
            
            
    $highest $arrayinputs[$i];

            
    $lowest $arrayinputs[$i];

        }

        if (
    $arrayinputs[$i]>$highest){

            
    $average += $highest// add the previous highest if new highest is found


            
    $highest $arrayinputs[$i]; // replace the old highest

        
    }elseif ($arrayinputs[$i]<$lowest){
            
            if(
    $lowest!=$highest){ // this if is necessary since $lowest = $highest during the first loop avoiding duplicate addition.

                
    $average += $lowest// add the previous lowest if new lowest is found

            
    }

            
    $lowest $arrayinputs[$i]; // replace the old lowest

        
    }elseif($arrayinputs[$i]>$lowest && $arrayinputs[$i]<$highest) {

            
    $average += $arrayinputs[$i]; // otherwise just add them.

        
    }

    }

    print_r('average: '.$average/($size-2)); // $size-2 since max and min is excluded. 
    Only valid if all inputs are entered prior processing.

    regards,

  5. #5
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Code:
    L = [9.20, 9.00, 8.75, 9.40 ,9.50, 8.90, 9.60]
         
    for x, num in enumerate(L):
        if not x: low = num
        if num >= low: high = num
        if num < low: low = num
        if num > high: high = num
        
    print "Highest: ", high
    print "Lowest: ", low
    print "Average: ", sum(L) / len(L)
    Highest: 9.6
    Lowest: 8.75
    Average: 9.19285714286


    though I could use the .sort() and index it with len functions.

  6. #6
    OT: wow, another assignment thread! what a day indeed! Katawa nlng ta ani Mark? ^_^

    the code is above, just in PHP format, convert it to C++.

  7. #7
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    mine is in python ^^ hahahahaha

  8. #8
    hehehe!! u guys don't read that much don't you?..


    Quote Originally Posted by pau_liniment
    or i can send you a copy of my code and correct it for my benefit XD..
    just reply to this post with your e.mail!
    what's wrong on searcing for a good reference or a mentor?>..

    sorry again for the trouble...

    ps: thanks anyway for those who gave there ideas...

  9. #9
    Elite Member
    Join Date
    Aug 2008
    Gender
    Male
    Posts
    1,422
    Blog Entries
    1
    try to analyze the problem and make ur own program so that it will be just checked and you can also learn something...LOL

  10. #10
    Quote Originally Posted by silent-kill View Post
    your just being lazy, why did you even take up CS/IT if you dont like solving problems?.

    that like what you learn in gradeschool adding averaging numbers.

    remember this is the fundamental concepts you'll need to learn if you want to survive in the real world LOL LOL
    sakto si silent kill...bro imo man ko gipakatawa

    epa email pa niya
    paul its so basic, jut keep on reading and practice.......

  11.    Advertisement

Page 1 of 4 123 ... LastLast

Similar Threads

 
  1. to all people out there!
    By khaye in forum Computer Hardware
    Replies: 6
    Last Post: 01-01-2013, 02:25 PM
  2. Replies: 13
    Last Post: 04-05-2011, 11:51 AM
  3. To all guys out there!!
    By jhellie_baby in forum Relationships (Old)
    Replies: 9
    Last Post: 10-14-2009, 05:12 PM
  4. To All Engineers Out There..need your help.
    By jcuizon in forum General Discussions
    Replies: 0
    Last Post: 10-11-2009, 08:26 PM
  5. to all programmers out there... I NEED HELP XD
    By pau_liniment in forum General Discussions
    Replies: 0
    Last Post: 08-30-2008, 09:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top