+0  
 
0
759
2
avatar+226 

Hi there, I know this is a website for math, however, I was wondering if someone could help me with this c-programming question. 

Thanks!

 

You just computed final scores for all of the students in your classroom and would like to tell each student their ranking when compared to the other students in your class. For example, if Remi's score is 14, Yan's score is 2 and Maria's score is 20 then Remi's ranking is 2 since he has the second highest score, Yan's ranking is 3 since he has the lowest score and Maria's ranking is 1 since she has the highest score amongst the three students.

You'll be given the following inputs: first the number of students, then all of the students' final scores, then finally, all of the students' names. Be sure to look at the example below.

Your output should be one line per student, with each line displaying the student's name followed by "rank is" followed by the student's rank.

The order in which names are displayed in the output should be the same as the order given in the input. The ranking starts at 1 (meaning this student has the highest score), 2 for the second highest grade etc...

Example:

Input

3
14
2
20
Remi
Yan
Maria

Output

Remi rank is 2
Yan rank is 3
Maria rank is 1

 Jul 1, 2020
 #1
avatar+1005 
0

I don't usually do this kind of stuff in C but in Java...

 

I'd reckon you do something like this.

 

First, you might want to create an array.

 

Say,

 

int input[] = {A1, A2, A3, A4, A5}

 

 

 

Then, compare A1 to A2, use result to compare to A3...

 

Maybe, use the minToMax function.

 

I don't really know, go to StackOverflow and search something up.

 Jul 1, 2020
 #2
avatar+1262 
+1

I do Python,JavaScript,HTML, and CSS but I don't do C sorry :(

jimkey17  Jul 2, 2020

2 Online Users

avatar