在考生文件夾下,給定程序MODI.C的功能是:
求一維數(shù)組a中的最大元素及其下標(biāo)。
例如,當(dāng)一維數(shù)組a中的元素為:1,4,2,7,3,12,5,34,5,9,
程序的輸出應(yīng)為:The max is: 34,pos is: 7 。
#include
#include
void main()
{ int a[10]={1,4,2,7,3,12,5,34,5,9},i,max,pos;
max = a[0];
pos = 0;
for ( i=1; i<10; i++)
/************found************/
{
/************found************/
max=a[i]; |
pos =i;
}
printf("The max is: %d ,pos is: %d\n", max , pos);
}
![]() | ![]() .. 定價:¥225 優(yōu)惠價:¥213 更多書籍 |
![]() | ![]() .. 定價:¥133 優(yōu)惠價:¥133.0 更多書籍 |