// 顺序查找.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"#include<stdio.h>#include<windows.h>
void _tmain(int argc, _TCHAR* argv[])
{
int data[10] = {75,23,98,44,57,12,29,64,38,82};
int i, input;
printf("\n<<Squential search>>\n");
printf("\nData:");
for (i = 0; i a< 10; i++)
printf("%d ",data[i]);
puts("");
printf("\nPlease enter a number from data:");
scanf("%d",&input);
printf("\nSearch......\n");
for (i = 0; i < 10; i++)//依次查找数据
{
printf("\nData when search %2d time(s) is %d!",i+1,data[i]);
if (input == data[i])
break;
}
if (i == 10)
printf("\n\nSorry,%d not found!", input);
elseprintf("\n\nFpund,%d is the %dth record in data!",input,i+1);
printf("\n");
system("pause");
}