vector find

#include <iostream>
#include <vector>

int main() {
    // Step 1: Create a vector of integers
    std::vector<int> numbers = {1, 2, 3, 4, 5};

    // Step 2: Define the value to search for
    int targetValue = 3;

    // Step 3: Use the std::find algorithm to search for the value in the vector
    auto it = std::find(numbers.begin(), numbers.end(), targetValue);

    // Step 4: Check if the value was found
    if (it != numbers.end()) {
        // Step 5: Calculate the index of the found value
        int index = std::distance(numbers.begin(), it);

        // Step 6: Print the index of the found value
        std::cout << "Value " << targetValue << " found at index " << index << std::endl;
    } else {
        // Step 7: Print a message if the value was not found
        std::cout << "Value " << targetValue << " not found in the vector." << std::endl;
    }

    return 0;
}