⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seqsearch.c

📁 这个是简单的初级的算法代码汗 不要在冒了
💻 C
字号:
#include <stdio.h>

int seqSearch(int list[],int last,int target,int *locn)
{
  int looker;
  int found;

  looker = 0;
  while (looker < last && target != list[looker])
    looker++;

  *locn = looker;

  if (target == list[looker])
    found = 1;
  else
    found = 0;

  return found;
}

void main()
{
   int list1[10]={45,2,12,14,22,21,5,34,32,9},i;
   int location;

   for(i=0;i<10;i++)
      printf("%d  ",list1[i]);
   printf("\n");

   if (seqSearch(list1,9,22,&location) == 1)
      printf("target is 22,the loacation is : %d",location);
   else
      printf("target is 22,not found!");
      


   getch();
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -