Thread: arrays.. dropping the lowest and highest then compute its average

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2009
    Location
    land of paradise:-)
    Posts
    1

    Unhappy arrays.. dropping the lowest and highest then compute its average

    You were at the 2008 Olympics. You were watching Gymnastics at the National Indoor Stadium in Beijing. There were ten judges in the Stadium. Another ten judges were at a remote venue. The judges give the gymnasts a score from 1 - 10 (they can give scores such as 9.3, 8.5 as well).

    You were not satisfied with the displaying of the scores of the gymnasts in the stadium because no average is displayed. Since you brought with you your Apple, you decided to make your own program for the average score.Store the scores of the judges in Stadium in one array. The judges' score from the remote venue should be stored in a separate array.

    Create a third array. Copy the judges' (the 20 judges) scores in this third array. Compute the average of the scores given by the judges. In computing for the average, the minimum and the maximum scores should not be included. Display this average. Also display the judges who gave the gymnast the lowest and highest scores.
    -----------we are not yet allowed to used the functions..pls..!!!!,, help me to finish this code.. i don't know what will i do next..i don't know how to drop the lowest and highest score then compute its average.. pls.. kindly check at my codes..

    --i'm just new in programming language.

    ----►here is my codes:
    Code:
    #include <iostream.h>
    void main()
    
    {
    	float arr[10], sum=0,arr2[10], sum2=0;
    
    	cout<<"Beijing, Gymnast Competition Olympics year of 2008."<<endl;
    
    	cout<<"scores of the judges in the stadium:"<<endl;
    
    	for(int i=0; i<10; i++){
    		cin>>arr[i];
    
    	for(i=0; i<10; i++)
        	sum = arr[0] + arr[1] + arr[2] + arr[3] + arr[4] +arr[5] + arr[6] + arr[7] + arr[8] + arr[9];
    
    
    	
    	float ave = (float)sum/10;
    
    	cout<<"The average of the judges in the stadium is "<<ave<<"."<<endl;
    
    	}
    
    	cout<<"scores of the judges in the remote venue:"<<endl;
    
    	for(int g=0; g<10; g++){
    	cin>>arr2[g];
    
    	for(g=0; g<10; g++)
        	sum2 = arr2[0] + arr2[1] + arr2[2] + arr2[3] + arr2[4] +arr2[5] + arr2[6] + arr2[7] + arr2[8] + arr2[9];
    
    
    	
    	float sum_of_ave = (float)sum2/10;
    
    	cout<<"The average of the judges in the remote venue is "<<sum_of_ave<<"."<<endl;
    	}
    
        cout<<"scores from judges in the stadium and in the remote venue in the gymnastics:"<<endl;
    	
    	float arr3[20], sum3=0 ,low=0, high=0;
    	
    	arr3[20]=arr[0] + arr[1] + arr[2] + arr[3] + arr[4] +arr[5] + arr[6] + arr[7] + arr[8] + arr[9]+arr2[0] + arr2[1] + arr2[2] + arr2[3] + arr2[4] +arr2[5] + arr2[6] + arr2[7] + arr2[8] + arr2[9];
    	 
    	for(int k=0; k<20; k++)
    		cin>>arr3[k];
    	
    {
    
    	for(int k=0; k<20||k>20; k++)
    		if (arr3[k]<low)
    			low=arr3[k];
    
    		if (arr3[k]>high)
    			high= arr3[k];
    	}
    		
    			
    
    float	total=(float)sum3/18;
    
    		cout<<"The average of the gymnast is"<<total<<endl;
    		cout<<"The lowest score is"<<low<<endl;
    		cout<<"The highest score is"<<high<<endl;
    }
    Last edited by Salem; 02-22-2009 at 01:59 AM. Reason: Added [code][/code] tags, learn to do it yourself

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. Sorting an int array highest to lowest
    By switchback in forum C Programming
    Replies: 3
    Last Post: 07-27-2008, 03:30 AM
  3. Trying to sort numbers from lowest to highest
    By jw232 in forum C++ Programming
    Replies: 21
    Last Post: 01-21-2008, 04:03 PM
  4. Displaying highest and lowest values
    By beastofhonor in forum C++ Programming
    Replies: 3
    Last Post: 10-29-2006, 08:24 PM
  5. Creating a student grade book-how?
    By Hopelessly confused in forum C Programming
    Replies: 5
    Last Post: 10-03-2002, 08:43 PM