1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Could use some, no, a LOT of help on my arrays assignment (C)

  1. Apr 6, 2006 #1
    Here's the project sheet. it's due tomorrow btw

    "Write a program to input, compute, and display various statistics for a list of test scores of up to 30 positive test scores of type double. You shall input an array with the following values as one of your test cases (use -1 as a sentinel value):

    73.5 83.0 58.0 0.0 95.0 69.0 83.2 99.0 74.5 80.0
    90.0 92.0 60.0 77.5 66.5

    Your program shall display the original test scores (max 8 values per line), sorted test scores in descending order (max 8 values per line), count (number of test scores), highest, average, median, and standard deviation in a readable format using one digit after the decimal place. It then finally prints the percent of the students that passed the class (70% or better). Write down the pseudocode before attempting your code on the computer.

    Extra credit: You can earn up to 5 additional points if you are able to print a student id, test score, and a letter grade in descending order according to the test score. Assume that the first test score belongs to student 1, second test score belongs to student 2, and so on. Use a standard grading scale of 90%, 80%, 70%, and so on. See sample output below. Hint: You either use two arrays or a structure.

    Id Score Grade
    8 99.0 A
    5 95.0 A
    . . .
    4 0.0 F
    "


    i have this, a simple array s tructure so far:

    Code (Text):
    #include <stdio.h>
    #define MAXARR 30

    main()
    {
        int
            arr[MAXARR],i,counter,value,no_of_elements,max;
        /*--------------------------------------------------------------------*/
        /* Input routine  User is required to enter values from keyboard      */
        /*--------------------------------------------------------------------*/

        printf("\f");
        counter = 0;
        printf("Do not enter more than %d values please\n\n",MAXARR);
        printf("Please enter value (-1 to quit:   ");
        scanf("%d",&value);
        while (value != -1)
        {
            arr[counter] = value;
            printf("Please enter value (-1 to quit):   ");
            scanf("%d",&value);
            counter = counter + 1;
        }

        /*--------------------------------------------------------------------*/
        /*  output routine.  elements and no. of elements is displayed        */
        /*--------------------------------------------------------------------*/
        no_of_elements = counter;
        printf("%d values were enetered\n",no_of_elements);
        printf("these values are:  \n");
        for(i=0;i<no_of_elements;i=i+1)
            printf("%d  ",arr[i]);

        /*-------------------------------------------------------------------*/
        /* Findmax routine.                                                  */
        /*-------------------------------------------------------------------*/
        max=arr[0];
        for(i=1;i<no_of_elements;i=i+1)
            if(arr[i]>max)
            max = arr[i];

        printf("\n\nThe largest element stored in the array is: %d\n",max);
    i'm totally lost. i'm not sure how to modify this to make it work to the specifications of the project, also, i'm not sure how to implement the sort and searching and standard deviation to it.

    if it's too much, i am willing to pay for someone to walk me through it step by step. i simply don't have enough time!
     
  2. jcsd
  3. Apr 6, 2006 #2
    how about using two arrays one for the student ID and one for the score

    Then bubble sort the scores

    Arrange student IDs

    then finally group them.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Could use some, no, a LOT of help on my arrays assignment (C)
  1. Array help in C (Replies: 12)

Loading...