二十课:从数组中检索一个值
发表时间:2002-11-11 00:00:00 关键词:奥赛,PASCAL,编程,源码
(点击:) 把这篇文章告诉我的QQ或MSN朋友
program JianSuo(input,output);
var
s:array[1..100] of integer;
i,a:integer;
begin
for i:=1 to 100 do s[i]:=i;
write('Input a number:');
read(a);{ The number to be find in Array }
i:=0;
repeat
begin
i:=i+1;
if s[i]=a then writeln('the number is the ',i,' th of the Array.');
if (s[i]<>a) and (i=100) then writeln('the number is not in the Array.');
end;
until (s[i]=a) or (i=100);
end.
本站特约顾问律师常州东晟律师事务所朱立律师(电话13915029670,QQ646146109)提醒您:
本站文章皆为作者原创,其它媒体(包括但不限于报刊、杂志、网站、电视、电台)未经作者书面许可严禁转载(或部分摘录)!
本站文章皆为作者原创,其它媒体(包括但不限于报刊、杂志、网站、电视、电台)未经作者书面许可严禁转载(或部分摘录)!
