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

Click For Summary
SUMMARY

The discussion centers on a C programming assignment requiring the implementation of an array to manage and analyze a list of test scores. The program must input up to 30 double-type scores, compute statistics such as highest score, average, median, and standard deviation, and display results in a specified format. The user is advised to utilize two arrays for student IDs and scores, implement a bubble sort for ordering scores, and ensure the output meets the project's requirements, including a grading scale for letter grades.

PREREQUISITES
  • Understanding of C programming syntax and structure
  • Familiarity with arrays and basic data types in C
  • Knowledge of statistical calculations (mean, median, standard deviation)
  • Experience with sorting algorithms, specifically bubble sort
NEXT STEPS
  • Implement the calculation of average, median, and standard deviation in C
  • Research how to perform bubble sort on arrays in C
  • Learn how to format output in C for readability
  • Explore the use of structures in C for managing related data
USEFUL FOR

Students learning C programming, educators teaching data structures, and anyone looking to enhance their skills in statistical analysis and array manipulation in programming.

clook
Messages
32
Reaction score
0
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:
#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!
 
Physics news on Phys.org
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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K