解题思路:
注意事项:
参考代码:
#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 人评分
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:524 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)浏览:613 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:1434 |
三角形 (C语言代码)浏览:914 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:550 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:530 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:609 |
2^k进制数 (C语言描述,蓝桥杯)浏览:1420 |
勾股数 (C语言代码)浏览:800 |
字符串比较 (C语言代码)浏览:685 |