# Hadamard gate (CUDA-Q) [[h-gate|Hadamard gate]] implementation using CUDA-Q. ```cpp // Compile: nvq++ main.cpp -o main // Run: ./main #include struct kernel { __qpu__ void operator()() { cudaq::qubit q; h(q); // |0> -> |+> mz(q); } }; int main() { auto counts = cudaq::sample(kernel{}); counts.dump(); // ~50% |0>, ~50% |1> } ```