【说明】 请编写一个函数int SeqSearch(int list[],int

题型:问答题

问题:

【说明】
请编写一个函数int SeqSearch(int list[],int start,int n,int key),该函数从start开始,在大小为n的数组list中查找key值,返回最先找到的key值的位置,如果没有找到则返回-1。请修改程序中画线部分的错误并将不同情况下的输出结果补充完整。
【程序】
文件search.cpp的内容如下:
#include <iostream. h >
int SeqSearch( int list[ ] ,int start,int n,int key)

for(int i=start;i<=n;i++) //(1)

if( list[i] = key)//(2)

return i;


return -1;

void main( )

int A[10]
int key,count=0,pos;
cout <<" Enter a list of 10 integers:";
for(pos=0;pos<10;pos++)

cin >>A; //(3)

cout <<" Enter a key; ";
cin >> key;
pos=0;
while(( pos = SeqSearch ( A, pos, 10, key)) !=-1 )

count ++;
pos ++;

cout<<key<<"occurs" <<count<< (count!=1" times":" time") <<" in the list,"
<< endl;

第一种情况:输入2 3 12 6 8 45 8 33 7输入key:8
输出: (4)
第二种情况:输入2 3 126 8 45 8 33 7输入k6y:9
输出: (5)

考点:计算机软件水平考试初级程序员初级程序员下午试题
题型:问答题

《水边的狩猎》是()的壁画作品。

题型:问答题

恶寒发热,头痛鼻塞,咳嗽痰白,倦怠无力,气短懒言,舌淡苔白,此属()

A.阳虚感冒

B.体虚感冒

C.风寒感冒

D.风热感冒

E.时行感冒

题型:问答题

工程量清单计价的过程分为()两个阶段。

A.分部分项工程量清单和措施项目清单

B.招标人部分和投标人部分清单

C.工程量清单编制和工程量清单计价

D.标底的编制和投标报价

题型:问答题

我国现行税法规定,对法人或其他组织处以( )元以下罚款的违法案件,如果案情简单、事实清楚、违法后果比较简单且有法定依据应当给予处罚,就可以由税务行政执法人员当场作出税务行政处罚。

A.500
B.1000
C.2000
D.5000

题型:问答题

男性,26岁,外伤致肱骨中下1/3骨折,来院检查时发现有垂腕征,垂指畸形。

该患者合并哪条神经损伤()

A.尺神经损伤

B.臂丛神经损伤

C.正中神经损伤

D.桡神经损伤

E.正中、尺神经同时损伤

更多题库