Use AI to Modify and Improve Programs
Learn to use AI prompts to make controlled changes to C++ programs, improve readability, and understand each modification.
Modify and Improve Programs with AI
Use AI to explore how a program can be changed while keeping control of the code and understanding every edit. Start with a working program, make one change at a time, and run it after each change.
Prompt for a small change
I am a beginner learning [programming language]. Help me change the program below so it [describe one specific change]. First explain which part should change and why. Give me a hint so I can try it myself. Do not rewrite the whole program.
Program:
[Paste your code here]
Prompt for improving readability
Review this program for readability without changing what it does. Suggest one improvement at a time, explain the benefit in beginner-friendly language, and wait for me to approve each change before rewriting the code.
Program:
[Paste your code here]
Prompt for comparing versions
Compare my original program with the modified version. List the changes, explain how each change affects the program, and tell me what tests I should run to check that the behavior is still correct.
Original: [Paste the original code]
Modified: [Paste the updated code]
A safe improvement workflow
- Keep a copy of the original program.
- Ask for one small, clearly described change.
- Read and understand the suggested edit before using it.
- Run the program with normal and edge-case inputs.
- Ask questions about anything you cannot explain yourself.