【opencv C++版本】安装和学习 ==Windows下使用VSCode配置OpenCV开发环境

ref:https://opencv.org/releases/

ref:https://www.cnblogs.com/ticlab/p/16817542.html

c_cpp_properties.json

复制代码
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:/Users/HP/OpenCV-MinGW-Build/x64/mingw/bin"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64",
            "configurationProvider": "ms-vscode.makefile-tools"
        }
    ],
    "version": 4
}

照着ref 没安装成功,先写个二分查找把

C++ 复制代码
int search(int a[], int start, int end, int target){
    int mid = (start + end) /2;
    if (target < a[start] || target > a[end] || start >end) {
        return -1;
    }
    if (a[mid] == target){
        return mid;
    } else if (a[mid] >target)
    {
        return search(a, start, mid-1, target);
    } else if (a[mid] < target){
        return search(a, mid+1, end, target);
    }
int main(){
int arr[10] = { 1, 2, 3, 4, 5, 6, 9, 12, 25, 38};
    int key = -1;

    int size = sizeof(arr)/sizeof(arr[0]);
    int result = search(arr, 0, size-1, key);
    result == -1 ? std::cout <<  "在数组中没有找到" << key << "!" << std::endl :  std::cout <<  "在数组中找到" << key << " " << "下标为" << result << std::endl;
    return 0; 
}
    
相关推荐
肆忆_1 天前
# 用 5 个问题学懂 C++ 虚函数(入门级)
c++
不想写代码的星星2 天前
虚函数表:C++ 多态背后的那个男人
c++
端平入洛3 天前
delete又未完全delete
c++
端平入洛4 天前
auto有时不auto
c++
西岸行者5 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
哇哈哈20215 天前
信号量和信号
linux·c++
多恩Stone5 天前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系
开发语言·c++·人工智能·python·算法·3d·aigc
蜡笔小马5 天前
21.Boost.Geometry disjoint、distance、envelope、equals、expand和for_each算法接口详解
c++·算法·boost
悠哉悠哉愿意5 天前
【单片机学习笔记】串口、超声波、NE555的同时使用
笔记·单片机·学习
超级大福宝5 天前
N皇后问题:经典回溯算法的一些分析
数据结构·c++·算法·leetcode