} }
void aver_cour(void) {int i,j; float s;
for (j=0;j for (i=0;i float highest() {float high; int i,j; high=score[0][0]; for (i=0;i return(high); } float s_var(void) {int i; float sumx,sumxn; sumx=0.0; sumxn=0.0; for (i=0;i {sumx+=a_stu[i]*a_stu[i]; sumxn+=a_stu[i]; } return(sumx/N-(sumxn/N)*(sumxn/N)); } 7-15 #include int main() {void input(int [],char name[][8]); void sort(int [],char name[][8]); void search(int ,int [],char name[][8]); int num[N],number,flag=1,c; char name[N][8]; input(num,name); sort(num,name); while (flag==1) {printf(\ scanf(\ search(number,num,name); printf(\ getchar(); c=getchar(); if (c=='N'||c=='n') flag=0; } return 0; } void input(int num[],char name[N][8]) {int i; for (i=0;i {printf(\ scanf(\ printf(\ getchar(); gets(name[i]); } } void sort(int num[],char name[N][8]) { int i,j,min,templ; char temp2[8]; for (i=0;i for (j=i;j if (num[min]>num[j]) min=j; templ=num[i]; strcpy(temp2,name[i]); num[i]=num[min]; strcpy (name[i],name[min]); num[min]=templ; strcpy(name[min],temp2); } printf(\ for (i=0;i printf(\ } void search(int n,int num[],char name[N][8]) {int top,bott,mid,loca,sign; top=0; bott=N-1; loca=0; sign=1; if ((n while((sign==1) && (top<=bott)) {mid=(bott+top)/2; if (n==num[mid]) {loca=mid; printf(\ sign=-1; } else if (n if (sign==1 || loca==-1) printf(\ } 8-1 #include { void swap(int *p1,int *p2); int n1,n2,n3; int *p1,*p2,*p3; printf(\ scanf(\ p1=&n1; p2=&n2; p3=&n3; if(n1>n2) swap(p1,p2); if(n1>n3) swap(p1,p3); if(n2>n3) swap(p2,p3); printf(\ return 0; } void swap(int *p1,int *p2) {int p; p=*p1; *p1=*p2; *p2=p; } 8-2 #include {void swap(char *,char *); char str1[20],str2[20],str3[20]; printf(\ gets(str1); gets(str2); gets(str3); if(strcmp(str1,str2)>0) swap(str1,str2); if(strcmp(str1,str3)>0) swap(str1,str3); if(strcmp(str2,str3)>0) swap(str2,str3); printf(\ printf(\ return 0; } void swap(char *p1,char *p2) {char p[20]; strcpy(p,p1);strcpy(p1,p2);strcpy(p2,p); } 8-3 #include { void input(int *); void max_min_value(int *); void output(int *); int number[10]; input(number); max_min_value(number); output(number); return 0; } void input(int *number) {int i; printf(\ for (i=0;i<10;i++) scanf(\ } void max_min_value(int *number) { int *max,*min,*p,temp; max=min=number; for (p=number+1;p temp=number[0];number[0]=*min;*min=temp; if(max==number) max=min; temp=number[9];number[9]=*max;*max=temp; } void output(int *number) {int *p; printf(\ \ for (p=number;p #include {void move(int [20],int,int); int number[20],n,m,i; printf(\ scanf(\ printf(\ for (i=0;i scanf(\ printf(\ scanf(\ move(number,n,m); printf(\ for (i=0;i printf(\ \ printf(\ return 0; }