s_search.c
Posted lifelessfaultless
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了s_search.c相关的知识,希望对你有一定的参考价值。
#include <stdio.h> #include <stdlib.h> int Data[20] = {1, 7, 9, 12, 15, 16, 20, 32, 35, 67, 78, 80, 83, 89, 90, 92, 97, 108, 120, 177}; int Counter = 1; int Seq_Search(int Key) { int i; for ( i = 0; i < 20; i++ ) { printf("[%d]", Data[i]); if ( Key == Data[i] ) return 1; Counter++; } return 0; } void main() { int KeyValue; printf("Please enter your key value : "); scanf("%d", &KeyValue); if( Seq_Search(KeyValue)) printf(" Search Time = %d ", Counter); else printf("No Found!! "); }
以上是关于s_search.c的主要内容,如果未能解决你的问题,请参考以下文章