县城模版~顺序查找函数模版

2019-12-16  本文已影响0人  孟享广

顺序查找函数模版:

#include <iostream>
using namespace std;
template <class T>
int seqSearch(const T list[], int n, const T &key) {
    for(int i = 0; i < n; i++)
        if (list[i] == key)
            return i;
    return -1;
}
int main() {
    
    return 0;
}

本人技术水平有限,若有错误或不当之处,可以在本号内反馈给我,一起交流一起学习!


公众号底部二维码.jpeg
上一篇下一篇

猜你喜欢

热点阅读