原种场的鹏哥


私信TA

用户名:tianpeng1183

访问量:11473

签 名:

一条路走到黑

等  级
排  名 5585
经  验 1467
参赛次数 0
文章发表 25
年  龄 0
在职情况 学生
学  校 南京工程学院
专  业 交通设备与控制工程

  自我简介:


解题思路:





注意事项:





参考代码:

#include <stdio.h>

void test1(int shuzu[],int len);

void test2(int shuzu[],int len);

void test3(int shuzu[],int len);

int main()

{

int a=10;

int arr[10];

test1(arr,a);

test2(arr,a);

test3(arr,a);

return 0;

}

void test1(int shuzu[],int len)

{

for(int i=0; i<len; i++)

{

scanf("%d",&shuzu[i]);

}

}


void test2(int shuzu[],int len)

{

int _max,_min;

int max=shuzu[0],min=shuzu[0];

for(int i=0; i<len; i++)

{

if(max<shuzu[i])

{ max=shuzu[i];

_max=i;

}

if(min>shuzu[i])

{ min=shuzu[i];

_min=i;

}


}

int temp=shuzu[0];

shuzu[0]=shuzu[_min];

shuzu[_min]=temp;


int temp1=shuzu[9];

shuzu[9]=shuzu[_max];

shuzu[_max]=temp1;

}


void test3(int shuzu[],int len)

{

for(int i=0; i<len; i++)

printf("%d ",shuzu[i]);

printf("\n");

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区