用函数调用的方法求字符串的最大值和最小值

来源:互联网 发布:淘宝店铺查封怎么处理 编辑:程序博客网 时间:2024/05/16 14:36
#include <stdio.h>#include "string.h"float arry_maxandmin(a[10]){    int temp,i = 0,j;    for(j=0;j<10;j++){        for (i = 0; i < 10- 1 - j; i++)        {            if(a[i] < a[i + 1])            {                temp = a[i];                a[i] = a[i + 1];                a[i + 1] = temp;            }        }    }   printf("The max is %d,The min is %d\n",a[0],a[9]);    return 0;}int main(int argc, const char * argv[]) {    int score[10];    int i;    printf("input 10 scores:\n");    for(i=0; i<10; i++)        scanf("%d",&score[i]);        printf("\n");    arry_maxandmin(score);//数组名作为函数参数    return 0;}

这里写图片描述

0 0