Current location - Loan Platform Complete Network - Big data management - This is the third question. The question is in the picture. It's different every time. c-language program programming. We are scum. Waiting online for god's guidance
This is the third question. The question is in the picture. It's different every time. c-language program programming. We are scum. Waiting online for god's guidance
#include <stdio.h>

#include <stdlib.h>

int main()

{

//input

int pnum;

printf("Input the number of players:\ n");

scanf("%d",&pnum);

int *score;

score=(int*)malloc(pnum*sizeof(int));

for(int i=0;i<pnum;i++)

{

printf("Enter the score of player %d: ",i+1);

scanf("%d",&score[i]);

}

int mark=pnum;

int min;

int num=1; //rank number 1 2 3 ......

int *minci=(int*)malloc(pnum*sizeof(int));

for(i=0;i<pnum;i++) minci[i]=0;

while(mark)

{

min=99; //assigning an impossibly large number is sufficient

for(i=0;i<pnum;i++)

{

if(minci[i]==0)

< p> {

if(min>score[i])

min=score[i];

}

}

}//find min value

printf("min v %d",min);

for(i=0;i<. pnum;i++)

{

if(score[i]==min)

{

minci[i]=num;

mark--;

}

}

num++;

}//while

for(i=0;i<pnum;i++)

{

printf("%d",minci[i]);

}

return 0;

}