- 相關(guān)推薦
C語言程序改錯(cuò)習(xí)題
行動(dòng)是通向成功的唯一途徑。以下是小編為大家搜索整理的C語言程序改錯(cuò)習(xí)題,希望能給大家?guī)韼椭?更多精彩內(nèi)容請(qǐng)及時(shí)關(guān)注我們應(yīng)屆畢業(yè)生考試網(wǎng)!
在考生文件夾下,給定程序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************/
if(max
if (max > a[i])
{
max = a[i];
/************found************/
pos=i;
i = pos;
}
printf("The max is: %d ,pos is: %d\n", max , pos);
}
【C語言程序改錯(cuò)習(xí)題】相關(guān)文章:
C語言程序改錯(cuò)輔導(dǎo)07-30
C語言程序改錯(cuò)題練習(xí)07-03
C語言經(jīng)典程序題05-05
C語言程序的段06-14
C語言程序介紹03-01
C語言程序試題04-26
C語言程序分析03-30