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

📄 testbinarysearch.cpp

📁 C++编成数据结构与程序设计方法 D.S.Malk编著
💻 CPP
字号:
#include <iostream>
#include "searchSortAlgorithms.h"
 
using namespace std;

int main()
{
    int intList[] = {2, 16, 34, 45, 53, 
                     56, 69, 70, 75, 96};           //Line 1

    int pos;                                        //Line 2

    pos = binarySearch(intList, 10, 45);            //Line 3

    if (pos != -1)                                  //Line 4
        cout << "Line 5: " << 45
             << " found at position " 
             << pos << endl;                        //Line 5
    else                                            //Line 6
        cout << "Line 7: " << 45 
             << " is not in intList " << endl;      //Line 7
    return 0;
}

⌨️ 快捷键说明

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