一级棒(Eachfun)
一级棒 - 教学经纬 - 奥赛辅导 - 二十课:从数组中检索一个值
RSS订阅
二十课:从数组中检索一个值
发表时间:2002-11-11 00:00:00 关键词:奥赛,PASCAL,编程,源码

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)提醒您:
本站文章皆为作者原创,其它媒体(包括但不限于报刊、杂志、网站、电视、电台)未经作者书面许可严禁转载(或部分摘录)!
发表评论
称呼:
QQ:
邮箱:
链接:
内容:
搜索: 百度搜索 Google搜索
Copyright©2000 - 2008 Eachfun.Com, All Rights Reserved 一级棒网络
苏ICP备05080156号
一级棒建站系统 http://www.eachfun.com 一级棒版权所有,未经许可不得商用!