This is a simple C++ code to verify your OpenCV installation. You can use it to verify your installation for default CPU version, and also for CUDA module.
You can learn how to install OpenCV with CUDA support by reading this article: https://medium.com/@batuhanhangun/opencv454-gpu-support-cpp-bef2cc145090
You can learn how to set your Visual Studio environment for OpenCV by reading this article: https://medium.com/@batuhanhangun/setting-visual-studio-up-for-opencv-c-bd1b198b5113