Problem 1. Suppose you have to design software for the Oscar Jury members where they can ate the nominated movies on a scale of 1-10. Here is the movie list • Nayak: The Hero • The Cloud-Capped Star • The Music Room ● Pather Panchali Charulata Subarnarekha Days and Nights in the Forest • • The Unnamed The program will ask five judges to rate movies one by one. After completing the rating from all ive judges, the output window will show the movie name and its rating in a. ascending order of rating if your ID is even. b. descending order of rating if your ID is odd. Note: Use of Pointer is mandatory.
Use the descending order. And kindly give a description below after completing the code in C.
![Problem 1. Suppose you have to design software for the Oscar Jury members where they can
rate the nominated movies on a scale of 1-10. Here is the movie list
• Nayak: The Hero
●
●
The Cloud-Capped Star
The Music Room
Pather Panchali
● Charulata
Subarnarekha
● Days and Nights in the Forest
● The Unnamed
The program will ask five judges to rate movies one by one. After completing the rating from all
five judges, the output window will show the movie name and its rating in
a. ascending order of rating if your ID is even.
b. descending order of rating if your ID is odd.
Note: Use of Pointer is mandatory.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F651b82c3-eee7-418f-8557-8de1fcb0a97d%2F83f87834-be30-476d-8412-37cac8cc4600%2Fw1rqeii_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Please give the correction from this code, where I made the mistakes. The extra two output shown here. How to remove that?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// movie structure
struct movie {
char movieName[1025];
int rating;
};
int main(void) {
// movie structure variable
struct movie list[10];
// movie structure pointer variable
struct movie *ptr = list;
int ID;
// assign std to ptr
char buff;
for (int i = 0; i < 8; i++) {
printf("Enter number %d movie name: ",i+1);
//scanf("%s",&ptr->movieName);
gets(ptr->movieName);
printf("Enter rating: ");
scanf("%d", &ptr->rating);
buff = getchar();
// update pointer to point at next element
ptr++;
}
// reset pointer back to the starting
ptr = list;
printf("Enter your ID: ");
scanf("%d",&ID);
struct movie temp;
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < (9 - i); j++)
{
if (list[j].rating < list[j + 1].rating)
{
temp = list[j];
list[j] = list[j + 1];
list[j + 1] = temp;
}
}
}
if(ID%2){
for (int i = 0; i < 10; i++)
printf("%s %d\n", list[i].movieName,list[i].rating);
}
else {
for (int i = 9; i >=0; i--)
printf("%s %d\n", list[i].movieName,list[i].rating);
}
return 0;
}
![Enter rating: 4
Enter number 2 movie name: deffe
Enter rating: 3
Enter number 3 movie name: dcedf
Enter rating: 6
Enter number 4 movie name: edcfew
Enter rating: 2
Enter number 5 movie name: decef
Enter rating: 6
Enter number 6 movie name: frrf
Enter rating: 9
Enter number 7 movie name: refref
Enter rating: 5
Enter number 8 movie name: edrfe
Enter rating: 4
Enter your ID: 538648383
frrf 9
dcedf 6
decef 6
refref 5
efre 4
edrfe 4
deffe 3
edcfew 2
♥0
à e
Process returned 0 (0x0)
Press any key to continue.
execution time : 19.834 s](https://content.bartleby.com/qna-images/question/651b82c3-eee7-418f-8557-8de1fcb0a97d/d3addafc-0108-4584-8315-3fc89b56aa31/j1d64d_thumbnail.png)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)