Thread: help please

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    5

    help please

    hi i am working on my computer science homework and its due tomorrow. I have most of it done but it is not compiling and its really frustrating, if someone could give me a hand i would appreciate it, here is my code:


    Code:
    #include<stdio.h>
    #include<stdlib.h>
    #include<math.h>
    
    
    int maximum(double grades[], int n);
    /* Given an array of real numbers and the effective
    size of the array (i.e. count of the numbers in the
    array), this function returns the location of the
    highest number in the array */
    
    int minimum(double grades[], int n);
    /* Given an array of real numbers and the effective
    size of the array (i.e. count of the numbers in the
    array), this function returns the location of the
    lowest number in the array */
    
    void deleteElement(double grades[], int *n, int loc);
    /* Given an array of real numbers, the effective size
    of the array and the location of the element to be
    deleted, this function deletes that element from the
    array by shifting the rest of the elements one
    position to the left and decrementing the count by one
    */
    
    double mean(double grades[], int n);
    /* Given an array of numbers and the effective size of
    the array this function computes and returns the mean
    */
    
    double StandardDeviation(double grades[], int n);
    /* Given an array of numbers and the effective size of
    the array, this function computes and returns the
    standard deviation as described in the previous
    section */
    
    
    
    int main(void){
    
        
        int n, loc, sum, i;
        double grades[100];
        for (i=0; i<100; i=i+1){
        printf("Enter first grade:  ");
        scanf("%f", &n);
        grades[i] = n;
        }
    
        /*finds the sum of all grades*/
        sum=0;
        for (i=0; i<=99; i=i+1)
            sum=sum + grades[i];
                printf("%d", sum);
                return 0;
    }
    
        /*find minimun grade*/
    
           int minimum(double grades[], int n)
    {    
        
        int i, j, lowGrade = 100; 
       for ( i = 0; i < n; i++) 
          for ( j = 0; j < n; j++)
             if (grades[i] < lowGrade)
                lowGrade = grades[i]; 
                return lowGrade;
    }
    
    
    
    
           /* Find the maximum grade*/ 
    
            int maximum(double grades[], int n)
    {
       int i, j, highGrade = 0;
       for (i = 0; i < n; i++ )
          for ( j = 0; j < n; j++ )
             if ( grades[i] > highGrade ) 
                highGrade = grades[j]; 
                return highGrade; 
    }
    
            /*find the mean*/
             double mean(double grades[], int n)
    {
        int i, total = 0;
        for (i = 0; i <= n - 1; i++)
                total += grades[i];
        return (double) total/n;
    }
    
            /*find the standard deviation*/
    double StandardDeviation(double grades[], int n)
    {          ?}

    &#91;code]&#91;/code]tagged by Salem
    Last edited by bruceness; 10-30-2002 at 11:40 PM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    [me]Scans to the bottom fo the post and notices...[/me]
    Code:
     /*find the standard deviation*/
    double StandardDeviation(double grades[], int n)
    { ?
    Hm... Ya think that might be the reason it won't compile? The function doesn't have a matching closing braces.

    Use code tags.
    [code]
    ...Your code here...
    [/code]

    Edit your original post and add code tags to the start and bottom of the code.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    5
    i dont understand what you mean could you give me an example

  4. #4
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    > i dont understand what you mean could you give me an example
    View the attached file, and expierment with posting it in a preview post window only.
    The world is waiting. I must leave you now.

Popular pages Recent additions subscribe to a feed