-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
#include<stdio.h>
#define N 999
void Add();
int main()
{
int Grade[N];
int iC,n,n1=0;
printf("Please input the number of the students you want:___\b\b\b");
scanf("%d",&n); //From now on, "n" is what you inputed!
for(iC=0;iC<n;iC++)
{
n1++;
printf("Input your No.%d student's Grade:__\b\b",n1);
scanf("%d",&Grade[iC]);
if(Grade[iC]<0)
{
printf("The Grade you inputed is illegal\n");
return 0;
}
}
printf("The array you inputed is:");
for(iC=0;iC<n;iC++)
{
printf("%d ",Grade[iC]);
} //Output the array you inputed!
//Bubble sort
int i,temp;
for(iC=0;iC<n-1;iC++)
for(i=0;i<n-1-iC;i++)
{
if(Grade[i]<Grade[i+1])
{
temp=Grade[i];
Grade[i]=Grade[i+1];
Grade[i+1]=temp;
}
}
//Output the array after babble sort!
printf("\nThe array reorganized is:");
for(iC=0;iC<n;iC++)
{
printf("%d ",Grade[iC]);
}
printf("\n");
//Output max and min
printf("The highest socre is :%d\nThe Lowest socre is :%d\n",Grade[0],Grade[n-1]);
Add();
return 0;
}
void Add()
{
char Names[N];
printf("Input whatever you want:"
"\n_____________________________\r");
scanf("%s",&Names);
printf("%s",Names);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels