當前位置:編程學習大全網 - 電腦編程 - //查找壹個數組中是否含壹個整數。

//查找壹個數組中是否含壹個整數。

1、a[8]=x

2、i==8

完整的程序:

#include <stdio.h>

void main()

{

int a[9]={1,2,3,4,5,6,7,8},i,x;

scanf("%d",&x);

a[8]=x;i=0;

while(a[i]!=x) i++;

if(i==8)

printf("no found");

else

printf("found");

}

找不到的情況:

9

no foundPress any key to continue

找得到的情況:

6

foundPress any key to continue

  • 上一篇:金科網校是真是假?
  • 下一篇:東莞綠能軟件開發研究院怎麽樣
  • copyright 2024編程學習大全網