Tell HN: A new way to use GPT-3 to generate code (and everything else)
Seems like this also works with C++. This was my first time using GPT3, and first attempt at this, no fine-tuning, no cherry picking at all:<p><pre><code>    Replace the $$dollar-quoted expressions$$ with the content described therein, or follow the directions they contain.

    main.cpp
    ```
    $$c++ includes for output$$

    $$Vec3 struct with three float members x, y, z. constructor. dot product implementation. $$

    $$main method which allocates two vectors, then prints the dot product of them to standard output$$
    ```

    Answer:

    main.cpp
    ```
    #include <iostream>

    struct Vec3 {
        float x, y, z;
        Vec3(float x, float y, float z) : x(x), y(y), z(z) {}
        float dot(const Vec3& v) const {
            return x * v.x + y * v.y + z * v.z;
        }
    };

    int main() {
        Vec3 a(1, 2, 3);
        Vec3 b(4, 5, 6);
        std::cout << a.dot(b) << std::endl;
    }
    ```</code></pre>