查找数组中元素

1.数组
7
10
32
24
15
44
要查找的数:26
2.伪代码
Set position to O
Set found to false
WHILE(position < 6AND found is false)
IF(numbers[position]equals searchitem)
Set found to true
Else
set position to position+1
IF(found is true)
Write "The item is found"
Else
Write "The item is not there"
3.测试
position:0
found:false
position:1
position:1
found:false
position:2
position:2
found:false
position:3
position:3
found:false
position:4
position:4
found:false
position:5
position:5
found:false
position:6
The item is not there

posted @ 2022-10-09 19:47  20221418曾庆林  阅读(3)  评论(0编辑  收藏  举报