Build a program with AI
Direct a model to write C++ — and review the memory and type choices it makes on your behalf.
A small program produced under your direction.
Why C++ output needs sharper review than scripting languages, the prompt, and what to check.
Prerequisites
A coding assistant. A C++ compiler to run it, or read along.
What you must understand to judge it
- Types are explicit and fixed; a model picking int where it needs size_t or double is a real bug, not a style nit.
- Prefer the standard library (std::vector, std::string) over manual new/delete — ask for it.
- Every program enters at int main(); compile-then-run is the loop.
The prompt
Write a C++ program that prints the squares of 1 through 5. Constraints:- Modern C++ (C++17). Use the standard library, no manual memory management.- A function square(int n) returning int.- Range-based for loop over a std::vector.- Compiles clean with -Wall -Wextra. Output a single main.cpp and the command to compile and run it.Review what it writes
Review rubric
Tutorial
Learn the basics directly
The Learn tab writes the program by hand. Come here to direct it.
Concepts covered · 1
More like this
Your first Python program
Python reads almost like English. Write a small converter, see its output, and open the project in /code to keep editing.
Build a program with AI
The vibe-coder path for Go: the idioms you must recognise, the prompt, and the review that catches dropped errors.
Your first C++ program
C++ trades a little ceremony for a lot of speed and control. Write a first program, learn the compile-then-run cycle, and open it in /code.
Liked this one?
Pass it on
Discussion
Be the first to ask
Your questions stay private with the team. We can pin answers to share with everyone.
Sign in to ask a question privately on this tutorial.
Sign inNo pinned answers yet for this tutorial.