/* Note:Your choice is C IDE */
#include "stdio.h"
#define N 45
int inputSS(char names[][20],int score[],int num);
void printSS(char names[][20],int score[],int num);
void getMAX(char names[][20],int score[],int num);
main()
{
char names[N][20];
int score[N];
int num=0;
int choose;
printf("What do you want to do:INPUT(1),OUTPUT(2),MAX(3),EXIT(0):");
scanf("%d",&choose);
do{
switch(choose){
case 1:num=inputSS(names,score,num);
break;
case 2:printSS(names,score,num);
break;
case 3:
getMAX(names,score,num);}
printf("\nWhat do you want to do:INPUT(1),OUTPUT(2),MAX(3),EXIT(0):");
scanf("%d",&choose);}
while(choose!=0);}
int inputSS(char names[][20],int score[],int num)
{int n,i;
printf("\nThis time,how many students do you want to input:");
scanf("%d",&n);
if((n+num)>N||n<1)
{printf("not valid sum\n");
return num;}
printf("NOW INPUT AS (NAME SCORE):\n");
for(i=0;i<n;i++)
{printf("%d.",i);
scanf("%s %d",&names[i+num],&score[i+num]);}
printf("THIS TIME,INPUT IS OVER\n");
return num+n;}
void printSS(char names[][20],int score[],int num)
{int i;
if(num==0)
{printf("NO STUDENTS NOW\n");
return;}
printf("\nNOW,THE STUDENTS SCORES AS FOLLOWS\n");
for(i=0;i<num;i++)
printf("%2d. name:%10s score:%3d\n",i,names[i],score[i]);}
void getMAX(char names[][20],int score[],int num)
{int i,max_index,max_score;
if(num==0){printf("NO STUDENTS NOW\n");
return;}
max_index=0;
max_score=score[0];
for(i=1;i<num;i++)
if(score[i]>max_score)
{max_score=score[i];
max_index=i;}
printf("The Top Score is %d by %s\n",score[max_index],names[max_index]);
}
#include "stdio.h"
#define N 45
int inputSS(char names[][20],int score[],int num);
void printSS(char names[][20],int score[],int num);
void getMAX(char names[][20],int score[],int num);
main()
{
char names[N][20];
int score[N];
int num=0;
int choose;
printf("What do you want to do:INPUT(1),OUTPUT(2),MAX(3),EXIT(0):");
scanf("%d",&choose);
do{
switch(choose){
case 1:num=inputSS(names,score,num);
break;
case 2:printSS(names,score,num);
break;
case 3:
getMAX(names,score,num);}
printf("\nWhat do you want to do:INPUT(1),OUTPUT(2),MAX(3),EXIT(0):");
scanf("%d",&choose);}
while(choose!=0);}
int inputSS(char names[][20],int score[],int num)
{int n,i;
printf("\nThis time,how many students do you want to input:");
scanf("%d",&n);
if((n+num)>N||n<1)
{printf("not valid sum\n");
return num;}
printf("NOW INPUT AS (NAME SCORE):\n");
for(i=0;i<n;i++)
{printf("%d.",i);
scanf("%s %d",&names[i+num],&score[i+num]);}
printf("THIS TIME,INPUT IS OVER\n");
return num+n;}
void printSS(char names[][20],int score[],int num)
{int i;
if(num==0)
{printf("NO STUDENTS NOW\n");
return;}
printf("\nNOW,THE STUDENTS SCORES AS FOLLOWS\n");
for(i=0;i<num;i++)
printf("%2d. name:%10s score:%3d\n",i,names[i],score[i]);}
void getMAX(char names[][20],int score[],int num)
{int i,max_index,max_score;
if(num==0){printf("NO STUDENTS NOW\n");
return;}
max_index=0;
max_score=score[0];
for(i=1;i<num;i++)
if(score[i]>max_score)
{max_score=score[i];
max_index=i;}
printf("The Top Score is %d by %s\n",score[max_index],names[max_index]);
}