1. Define function Implementation: Enter a number of students ' scores (enter the number of people or the end of a negative can), the average score, the highest score and the lowest score, and point out the highest score and the lowest score of students (give subscript), enter a score, indicating the results of the first few students, and finally according to the score from high to low (Minimum of seven functions.) Input function, mean function, max subscript function, minimum value subscript function, lookup function, sort function, output function)
#include <stdio.h>
#define N 999
int max (int fs[],int rs); Highest score
int min (int fs[],int rs);//Minimum score
int average (int fs[],int RS);//Average score
void SRFs (int fs[],int rs);//input fraction
void Zgxs (int fs[],int rs);//Top Student
void Zdxs (int fs[],int rs);//Minimum student
void Cfxt (int fs[],int rs);//cha-min system
void printcj (int fs[],int rs);//Sequential Output score
int main ()
{
int RS,FS[N],A[N],MAX,MIN,ZGF,ZDF;
Double PJF;
printf ("Enter the number of students \ n");
scanf ("%d", &rs);
SRFs (FS,RS);
Max=max (FS,RS);
Min=min (FS,RS);
Pjf=average (FS,RS);
printf ("Highest score is%d, lowest score is%d, average score is%.2f\n", MAX,MIN,PJF);
Zgxs (FS,RS);
ZDXS (FS,RS);
CFXT (FS,RS);
PRINTCJ (FS,RS);
return 0;
}
int max (int fs[],int rs)
{
int I,max;
for (i=1,max=fs[0];i<rs;i++)
{
if (Fs[i]>max)
{
Max=fs[i];
}
}
return Max;
}
int min (int fs[],int rs)
{
int i,min;
for (i=0,min=fs[0];i<rs;i++)
{
if (fs[i]<min)
{
Min=fs[i];
}
}
return min;
}
int average (int fs[],int rs)
{
int i,sum;
for (sum=0,i=0; (i+1) <=rs;i++)
{
Sum=sum+fs[i];
}
Return (double) sum/rs;
}
void SRFs (int fs[],int rs)
{
int i;
printf ("Enter student's score \ n");
for (i=0; (i+1) <=rs;i++)
{
printf ("Grade%d students", i+1);
scanf ("%d", &fs[i]);
printf ("\ n");
}
}
void Zgxs (int fs[],int rs)
{
int I,max;
Max=max (FS,RS);
for (i=0;i<rs;i++)
{
if (Max==fs[i])
{
printf ("Highest score student is%d \ n", i+1);
}
}
}
void Zdxs (int fs[],int rs)
{
int i,min;
Min=min (FS,RS);
for (i=0;i<rs;i++)
{
if (Min==fs[i])
{
printf ("The lowest score is%d students \ n", i+1);
}
}
}
void Cfxt (int fs[],int rs)
{
int i,j=0,a;
printf ("Input students ' grades, enquiry number \ n");
scanf ("%d", &a);
for (i=0; (i+1) <=rs;i++)
{
if (A==fs[i])
{
j + +;
printf ("%2d student is%d \ n", i+1,a);
}
}
printf ("A total of%d students is this score \ n", j);
}
void printcj (int fs[],int rs)
{
int i,j,h;
printf ("Rank in score order is \ n");
for (i=0; (i+1) <=rs;i++)
{
for (j=0; (j+1) <=rs;j++)
{
if (fs[j]<fs[j+1])
{
H=FS[J];
FS[J]=FS[J+1];
Fs[j+1]=h;
}
}
}
for (i=0;i+1<=rs;i++)
{
printf ("%d\n", Fs[i]);
}
}
2. Define an integer array of length 100, assigning the array element to the initial value ... 100, delete all values that are 3 or 7 times times, and the number of remaining digits in the output array and each number.
#include <stdio.h>
#define N 100
void print ();
int main ()
{
Print ();
}
void print ()
{
int a[n],i,j=0;
for (i=0;i<=100;i++)
{
a[i]=i+1;
}
for (i=0;i<100;i++)
{
if ((a[i]%7==0) | | | (a[i]%3==0));
Else
{
j + +;
printf ("%d", a[i]);
}
}
printf ("%d numbers remaining", 100-j);
}
Second, Summary:
1, a primary function corresponds to a sub-function. Note one by one corresponds.
2, variables need to give initial value
3, pay attention to the function's one by one corresponding when calling the function.
Job, 9