cpp execute command

#include <iostream>
#include <cstdlib>

int main() {
    std::cout << "Executing command...\n";

    // Command to be executed
    const char* command = "echo Hello, World!";

    // Execute the command and capture the result
    int result = std::system(command);

    // Check the result of the command execution
    if (result == 0) {
        std::cout << "Command executed successfully.\n";
    } else {
        std::cerr << "Command failed with exit code: " << result << "\n";
    }

    return 0;
}