Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a program called grades.c. The program will create an array and initialize the array with the following values: 89.5, 76.2, 88.1, 39.9, 45.9, 90.1,

Create a program called grades.c. The program will create an array and initialize the array with the following values: 89.5, 76.2, 88.1, 39.9, 45.9, 90.1, 88.4, 90.2, 77.0, 63.8

These values represent the grades obtained by a class of students for a course (call this array grades).

The program must also create an initialize another integer array that will hold the registration numbers of the equivalent students that obtained the above grades. Since this is a fictitious exercise, I want you to write code that will programmatically initialize the registration numbers. Start from 20201234 and every number after that must be 100 units greater i.e. 20201334, 20201434, 20201534 and so on until 20202134. Call this array students.

Write a function called void show_grades( int g[], int s[], int size) that will be used to pass the two arrays as argument together with the size of the arrays and it will output a

listing of: [reg.no] = grade

After you create the arrays, you must write code to:

  1. Show the arrays after creation using the show_grades() function.

  2. Realize and output what was the

    average grade of all the class.

  3. Realize and output which student (with which registration number)

    obtained the highest grade.

  4. If the passing grade was 60, what are the percentages of students

    that passed or failed the course.

  5. Write code to sort the grades array in descending order (from highest to lowest), not forgetting to 'swap' the students positions to match the grades positions (i.e. highest grade at position 0, registration number of

    highest grade at position 0).

  6. Repeat task 1 to show the sorted

    arrays

The capture on the right demonstrates a sample run.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions