Hi,
I am writing a piece of code for class. I am getting quite lost, so I was hoping perhaps I could get some guidance/direction. I didn't want to ask this early without having a complete program to post for review, but I'm not even sure how to construct the logic.
This is the question:
Suppose we have 10 students taking a test. Scores 0-100 can be with one decimal fraction. First implement the simpler problem for 60%, then extend to the full requirements.
Write a program that will read the scores into an array.
Simple version: After reading the scores, display all scores, then the average.
Student 1 score 95.0
....
Student 10 score 85.5
Test average 95.53
// note that scores all display 1 decimal digit and are lined up, average displays 2 decimal digits rounded.
Full version: Modify the display to display the letter grade A, B, C, D, or F of using the standard 10% scale.
Student 1 score 95.0 grade A
//etc
Extra 10: At the end, display the lowest and the highest score, using functions
float findLowest(float [], int)
float findHighest(float [], int).
If there are ties, pick any.
And this is what I have so far:
Code:#include <stdio.h> #include <math.h> #define N 10 int main(void) float grade[N], highscore, average_score; int x, i, numraise, studentname; for ( i<N; i=0 ;i++ ) { printf("Enter a grade: "); scanf("%f", &grade[x]) } while (0=numraise && numraise<=9, studentname=numraise+1, numraise++) { printf("Student %d's grade is %.1f", studentname, grade[x]) } return 0; }
What I am really unsure of is that in the printf line that is supposed to print studentname (student1...student2..student3...etc) how will I get the matching grade (grade[x]) to print alongside it?