How can I get better at writing C++ and C# without relying on tutorials?

0
4
Asked By MellowCedar42 On

I'm a second-year computer science student learning C# and C++. During my first year I started with C++, and now my classes use both languages, including C++ for data structures and algorithms. I can follow tutorials and understand what the code is doing, but I struggle to write even simple programs from scratch, such as a rock-paper-scissors game. My classes move much faster than beginner tutorials, and many of my classmates seem to be struggling too. How should I structure my practice, and are there better ways to move from understanding examples to solving problems independently?

4 Answers

Answered By PixelHarbor7 On

The biggest change is to stop treating coding as something you mainly watch. Start with very small programs: print a greeting, ask for a name, perform basic arithmetic, generate a random number and let someone guess it, or make a simple menu. Write each one yourself, even if it takes a long time. Practice is what teaches you to turn an idea into code.

CopperVale19 -

It also helps to begin with tiny exercises like addition, multiplication, and division before combining several ideas into a larger project.

Answered By QuietMaple58 On

What you’re describing is the difference between recognizing code and generating it. After learning a small concept such as loops or functions, close the tutorial and recreate a tiny example from memory. If you get stuck, look up only the specific piece you don’t understand instead of copying the complete solution. The struggle feels slower, but it’s what makes the knowledge stick.

Answered By AmberCircuit84 On

For data structures and algorithms, begin with easy problems and attempt them on paper or in your editor before checking an answer. Once you know the syntax, focus on the algorithm: what information is needed, what steps solve the problem, and what happens in each edge case. You’re probably not uniquely bad at this—tutorials often make code look easier than it feels to produce independently. Consistent practice will close that gap.

Answered By SyntaxSparrow31 On

Use a book, written guide, or structured course alongside practice so you understand why the code works, not just which lines to type. Think of programming like learning a language: learn the vocabulary and grammar, then plan the program’s flow in plain language before translating it into C++ or C#. For an assignment, break the problem into smaller steps and implement one step at a time.

NorthwindEcho6 -

A useful mental model is a recipe: variables are the ingredients, functions are the steps, and the finished program is the result. Write down the data you need and the transformations it must go through before worrying about syntax.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.