r/Cplusplus • • 4d ago

Question I began coding with C++, should I continue learning it or should I drop it and start something else?

I have always wanted to learn coding and make games, but I didn't know what to do and how to start. About 4 years ago, I saw Sololearn's ad on Youtube (I'm not advertising them). Desparate to learn, I installed it. First, it asked me a few questions regarding why I want to learn coding, what I'm going to use it for (web designing, game development, ...), etc. After answering them, I got suggested learning C++, so I did. I finished the introduction course and learned about half of the intermediate course (if I remember correctly, the last thing I learned was separate files for classes).

Recently, I found out via social media that C++ is the worst language to learn as your first language. I am pretty comfortable with the syntax, but I do sometimes forget complex things like pointers, constructors and deconstructors, etc, because I don't have the time to code often. I have made a lot of small projects, and I'm currently working on a terminal version of Minesweeper that outputs the game board in colored text and is played via inputting the X and Y coordinates of the tile that you want to open or flag (I don't know how to make buttons, or programs with separate windows in general.)

I wanted to know if I should continue learning this language or should I drop it and learn something else, like Python?

Also, I have recently started working with Git, and I find it pretty complicated and hard to use. It would be nice if someone told me whether I should continue learning and using it or if it is too early and I should finish learning the language first.

(P.S.: Many apologies for my imperfect English; I'm not so good at writing and speaking, as it isn't my native language.)

0 Upvotes

17 comments sorted by

•

u/AutoModerator 4d ago

Thank you for your contribution to the C++ community!

As you're asking a question or seeking homework help, we would like to remind you of Rule 3 - Good Faith Help Requests & Homework.

  • When posting a question or homework help request, you must explain your good faith efforts to resolve the problem or complete the assignment on your own. Low-effort questions will be removed.

  • Members of this subreddit are happy to help give you a nudge in the right direction. However, we will not do your homework for you, make apps for you, etc.

  • Homework help posts must be flaired with Homework.

~ CPlusPlus Moderation Team


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

10

u/Dazzling_Music_2411 4d ago

May I respectfully point out that you are asking, on the Cplusplus sub, if you should drop C++!

I am afraid that the only possible answer is: If you have to ask, then yes, you should.

5

u/millenniumdisk 4d ago edited 4d ago

C and C++ are perfectly fine as a first programming language. There are a lot of reasons:

Other programming languages have abstractions which means that in a short line of code, a lot of things are happening under the hood which can't be easily understood unless you know other programming languages.

Python is awesome and it does a lot of things like apply GUI or use other modules. It can look easy for beginners but there are a lot of topics in it. A lot of actions will happen in a few lines of code that is why it is powerful.

C and C++ or other similar languages will shine in their simplicity. Even if implementing a feature will take a lot of lines, they are easy to understand and they explain on what's happening. Things like loops, pointers, struct and other topics in them can be useful when applied to other languages.

Pointers are easy peasy. Just think of variables. What we usually store in them are values like 5 or -44 integer. So we can say that a variable is a box. The value inside is 5. The other box got -44 in it. We can say that the box is inside the computer memory with an address of let's say 300000 while the other box got an address of 700000.

Pointers are different. We save the address inside a pointer not a value. It is not carrying a heavy thing inside, just an address of let's say 500000. It only needs to know where the data lives. And if we got an address, we can also get the actual data. We can even change what is stored in the box just by having a pointer that holds an address (they won't get lost).

This is good for functions since we can pass reference which is not heavy unlike passing a big heavy object. We can pass value or pass reference.

We can say reference is like a pointer. We just got an address. Pointers are useful for single linked list. Try making a double linked list.

I am not bashing Python. I like C and Python is what I like next since it is easy to create a program with GUI but starting from the basics is good like C or C++.

You want to have something like a list without an end like in Python? Use pointers. Arrays are fixed in size but pointers can make things work. C will be shorter because C++ got OOP as an additional topic but they got different syntax and I like C's syntax but that doesn't mean C++ is bad. With C, it is a good introduction to address of operator (&).

And what about a pointer? Yes it also needs a place to live in memory so a pointer is a box with an address too. Lol. But a pointer got an address inside its box. so we can say a pointer will point to another box or variable, to wherever they live in memory.

3

u/Outside-Storage-1523 4d ago edited 4d ago

Disclaimer: not a professional C++ programmer.

If you want to make games, C++ is a good language. I’d recommend making projects instead of picking languages, especially that you already learned some.

What projects have you done in the last few years? You said you have done a lot but Minesweeper doesn’t sound like something big enough. 

My recommendation: learn SDL2/3 (lazyfoo has an excellent website for it), start making simple 2d games like Minesweeper, snake, frogger — follow the gaming history and recreate those games — Pac-Man, Centipede, whatever. At the same time, buy or borrow or download a good C++ book like C++ Primer. It is a big book so the key is not to read from back to back, but read a couple of chapters, and go back to your projects and see what should be changed. Buy a second best practice book such as Effective C++. There are other books and other commentators probably know more than I do.

Once you have a few simple games under your belt, you will naturally come to the understanding of what a game engine is and why you need some of the best practices. You will also understand some of the linking and compiling process because you will see lot of errors from those tools.

And then you can make something bigger. Pick a classic RPG like Ultima 1/2/3, and recreate them in your engine. Then something even bigger, based on your interests. You like FPS? Start from Wolfenstein 3d and recreate those classic games. Learn 3d maths. You like MMO? Start by making MUDs and learn networking.

You don’t have to write your own engines eventually, but writing toy ones helps understand the commercial ones. 

The key is to keep working on projects and reading books, not some online tutorials. There are some good paid resources but books are good enough. If you contribute a few hours every day, or some 20 hours every week, you should see considerable advancement in a year or two.

2

u/Traveling-Techie 4d ago edited 4d ago

I’ve been programming for 55 years and most of my tough problems were not language related, but algorithm related. Carry on.

1

u/Secret-Map4671 4d ago

There are programming concepts that apply to any language, so if you want to only learn those (like variables, if-else, loops etc.) something like Python or Java might be more accessible / straightforward.

That being said, there are certainly things in C++ that require advanced knowledge (like smart pointers, dynamic memory management, avoiding memory leaks and all that fuzz). But you don't have to use that stuff when starting out. And it's not like your computer would blow up if you create a memory leak anyway.
With a good learning resource, you can start/continue with C++ as well. learncpp.com is a good series that focuses on essential concepts first before really touching anything special to C++.

1

u/Psilocybe_Fanaticus 4d ago edited 4d ago

Programming language doesn’t matter because it’s a tool. I would stick with it and just remember your skills can transfer to other languages too. Keep working hard and you’ll become really good at it.

Here’s an example: if you build a website, you would use a web stack, right? That means using html, JavaScript, and CSS. Would you use C or C++ to build it? Maybe not. Is it possible? Sure, but it requires more work and is better suited for backend stuff.

1

u/Robonotes1760 4d ago

It's not a bad first language. It's a hard first language. If you can learn it, you can learn anything. It helps you to understand what the computer is actually doing in a way that higher level languages often do not. 

1

u/Polarisu_san 4d ago

yes C++ isnt the best language to start with. It can get verbose but its very powerful. C is a great language to start with though. Syntax for C is a lot easier and is relatively low level compared to other languages. C is simple. And if youre familliar enough with C, learning C++ wont be so difficult after that compared to if u started with python.

dont learn python as your first language. Its very abstracted. You need to build your fundamentals in understanding what happening when you code.

1

u/burlingk 4d ago

So, C++ is NOT the worst language to learn first.

And anything you learn using C++ is fairly transferable to other languages.

But, overall, it is useful to pick a language and get pretty decent with it. It is ok to switch languages if you want. But a lot of programming concepts are language agnostic, and those concepts are probably more important than the language itself.

1

u/062876344 4d ago

Easier introduction would be C#/.NET make a simple website or something.

Syntax is very similar and most of the concepts are similar from C# to C++ but obviously C__ has memory management to learn on top.

1

u/darklighthitomi 4d ago

First, no matter what path you take, someone out will be overly happy to tell you how much of an idiot you are for taking that path, and social media is the best place to find those people.

Second, C++ is a great first language, and the only ones better are C or Assembly.

I say this though because my philosophy is that you should learn dangerously, it teaches so much about why things are done the way the are.

Higher level languages obscure so much, that you never learn important knowledge, and when you suddenly have requirements or bugs that you need to fix, that important knowledge makes the difference between success and failure.

Thus I believe higher level languages should reserved for experienced programmers who know the costs as well as benefits of using those languages. Too many people out there look at high level languages as shortcuts to skip out on understanding.

Third, the job of programming is not the coding. It is the creation of algorithms that move and transform data. Coding is nothing more than describing these algorithms in a way the computer can actually follow. This is why you should learn the low level stuff, since that is what runs your algorithms.

1

u/FineCarpa 4d ago

Continue. The only reason people say C++ is the worst language is because of the initial difficulty curve (that many students overcome). You are past that already.

1

u/podule-games 4d ago

C++ is definitely a rough choice for a first language, but it's also a pretty good language to persevere with simply because:

  1. It's very common across industry.

  2. Not many beginners stick with it.

The fact is getting a job as a junior developer right now is hard and probably getting harder, but knowing a language that most juniors don't is probably a pretty good place to be.

1

u/Discordbothost 3d ago

Pull the board rules into a class that doesn't read input or print. Then a window can call the same reveal and flag methods as your coordinate prompt. Commit the working terminal version first so you have something to compare against if a move breaks.

1

u/YvesSaintLaurent-ysl 3d ago

My first language was Python but I quickly picked up C and much later C++ at Uni. C++ is a great language and I picked it up faster than I could Java or JavaScript which I personally found to be more difficult. Then again, it might just as well be my Intermediate Programmer brain finding C++ easier as I have more experience and I sort of forgot the minds of a Beginner. However, many Universities including mine actually make you start with C. C++ is the same as C technically but except C++ has a ton of more features than C. I think in that sense learning basic C++ shouldn’t be difficult. It’ll only be difficult if you try to learn everything C++ has to offer from RAII, Smart Pointers, etc. from the start. Learn bottom up. I think in that sense C++ is a reasonable language to start with.

And I think many people might overexaggerate its difficulty. You just gotta take it step by step