Search⌘ K
AI Features

Prompting AI as Your Coding Buddy

Explore how to communicate with AI to improve your C++ learning. Understand the basics of prompting AI to generate and refine code, enabling you to write your own programs, experiment, and solve coding problems effectively with AI support.

What is prompting?

Learning C++ isn’t something you do alone. You’ve got a partner: an AI that can write code, explain concepts, and help you debug when things go wrong.

But just like learning a new language, how you ask matters. Think of prompting as giving instructions to a very fast, patient helper.

By the end of this lesson, you’ll know how to:

  • Ask the AI for code.

  • Refine your request.

  • Use the AI to explore and experiment, rather than simply copying answers.

First prompt

Try asking the AI:

Write C++ code that prints 2 + 3 on the screen.

AI Powered
Saved
5 attempts left
Reset
You have 5 attempts to answer.
AI buddy

You’ll get a small snippet of code. Run it. That’s somewhat similar to what you created in the previous lesson, but now the AI did what you wanted to do.

C++
// Add your code here

Food for thought:

  • What did the AI give you?

  • Was it exactly what you asked for?

  • Did it add extras (like comments or explanations)?

Refining your prompt

Now, tweak your request (In the same AI buddy widget where you prompted earlier):

Change it to print the result of 2 + 3, not just the text.

Run it. Did the code change? Did it match your expectations?

If not, adjust your words. Try:

Make it print the result with a message: The answer for 2+3 is 5.

Notice how adding or changing just a few words makes the AI adapt.

Why this matters to you

As you move through this course, you’ll:

  • Write your own code first.

  • Then use prompting as a learning supplement: to compare, to experiment, or to get unstuck.

Now you’ve learned how to talk to your coding buddy.

  • Next, we will return to C++ fundamentals with your very first building block: Outputs and Strings.

  • In each chapter, you will build a cool new project in C++.