r/cpp • u/Orca365123 • Mar 31 '24
Just curious on the uses of C++
Hi!, I'm a high school student, and I want to learn c++. However, I'm just curious, what uses cases are there for c++ practically. For example, many websites say web development, but just leave it at that. Is c++ really good backend database interactions?, does it have libraries for building full blown windows applications. It would be awesome if people could share!
55
u/zer0xol Mar 31 '24
Software, games, programming languages, tools, everything
10
u/Potatoswatter Mar 31 '24
Seldom used to generate web content using db queries though.
2
u/emelrad12 Apr 02 '24 edited Feb 08 '25
carpenter innocent soft silky spoon ancient dam tease stocking badge
This post was mass deleted and anonymized with Redact
9
u/Secret-Cautious Mar 31 '24
Robotics software engineer here.
Basically all the robots in te entire world (and the frameworks used in robotics) use only C++ and Python.
C++ is used for all the performance critical or hardware related tasks such as reading and reacting to real time sensor data, sending motion commands, controlling motors or other actuators, and interacing with electronic devices / pcb boards in general, etc.
and Python is for everything else.
3
6
u/dowel79 Mar 31 '24
C++ is an excellent language to start programming with. It is a combination of four different languages, C, C's macro language, C with objects and template language. You can start with the C portion and gradually add other parts of the language. It will give you in-depth understanding of how computers work. Knowing C++ will keep you in the job market for many years to come.
It is a good language choice when working with databases. It is one of the languages of choice when building Windows applications. It can be used for web development, specifically the back-end. It is not the best choice for front-end web development though.
It has extensive built-in standard library and there are plenty of open source libraries that implement various other functionality.
6
u/grhayes Apr 01 '24
System development as in OS and drivers.
Game development, Server development, Databases, network, library development (graphics, audio, physics, math, ...), Compilers, website(rare but it happens), clients (terminals and so on),
Tools (IDEs, Editors, Text, Hex, graphics(3d,2d),
AI, Embedded systems, ... Basically anything that can be programmed has been done in C++ at some point.
5
4
Mar 31 '24
compilers, database internals, network programming, programming language runtimes, operating systems, games, graphics, embedded, high performance computing, high frequency trading, desktop applications — anything you want actually
3
u/According_Builder Mar 31 '24
C++ is a general programming language, so it can do whatever you make it do, though any Turing complete language can. Mostly it’s used for performance sensitive applications like game engines, but you also see it a lot in tooling or infrastructure such as compilers.
Like any programming language it’s a tool, so choose the right tool for the job. For anyone learning to program I would recommend everyone to be decently familiar with a language in the C family.
1
Apr 02 '24
A programming language is just a means to an end. In this casez some languages are better than others in certain areas. For example, programming a web server in C++ is most likely gonna be a hellscape compared to JS. But C++ is known for its performance so it's really good for game engines, creation tools, backend databases, OS, kernels, graphical based software etc.
1
u/accuracy_frosty Apr 07 '24
It’s the go to industry choice for game dev, extremely popular in robotics, embedded development, OS development, lots of desktop software uses it still, although proton was getting way more use than it deserves for a while, I see a good amount of servers made using it, even some web servers, although I’ve done it and I wouldn’t recommend it, browsers, really it can do anything, especially with a lot of the modern features, but that’s like pretty much any langauge, like if you managed to make a version of JavaScript that compiled to machine code and ran on its own, then you could probably write a kernel in it, it would be slow as shit, and it would be annoying because JavaScript makes everything annoying, but it could be done, Python is famous for being able to do anything just not very well, but I would argue in terms of being able to do anything, C++ is one of the best language out there, its biggest drawbacks come when the control that the language gives you comes back to haunt you. C++ gives you a gun, it’s up to you whether you use it to hit a target or shoot your foot. So a bunch of knuckleheads write C++ but have no clue how to write it properly and make it memory safe, so it has a reputation of being unsafe.
1
u/phi_rus Mar 31 '24
I use it for building tools of any kind, embedded stuff, desktop-apps, and anything with 3D graphics.
1
u/whydoesthisitch Mar 31 '24
In ML/AI we spend most of the day in Python, but all our underlying operations are written in cpp.
1
u/engineerFWSWHW Mar 31 '24
It's good to learn c++. I use it everyday on my job (embedded systems), while it can be used for lots of things, it doesn't mean you should c++ on everything as there are languages suited for particular use. For example, if you want to do some dsp or AI/ML/NLP stuffs, there are options like python and it makes things easier due to availability of libraries. Same for web development, there could be other better options rather than using c++. This is where your judgement and research comes into play.
Good thing it's that of you learn c/c++, the learning curve will be much lower if you switch to a language with similar syntax like c#, java.
-2
u/zorbat5 Mar 31 '24
I haven't started learning cpp myself yet. But one could argue that cpp might be the language that can do everything.
2
u/Orca365123 Mar 31 '24
Ic, how do you plan on learning?, just youtube, or do you know any other good websites
2
u/zorbat5 Mar 31 '24
I have a book called "C++ crash course" from no starch press. It's a base introduction to modern C++. I have programming experience in C, Python, C# and a tiny bit of rust. Mostly python though. I have dabbled into C++ several times in the passed but mostly just gave up.
I'm hella scared of C++ and don't know why. It's daunting to tackle such a huge language tbh.
2
u/Orca365123 Mar 31 '24
Oh ic, how recent is this book?, I might be able to find it on tpl if it's somewhat old maybe. Regardless, thank you for this info
1
u/zorbat5 Mar 31 '24
The book covers C++17 so it's not extremely new but also not very old. The copyright is from 2019 so I assume it realeased in that year.
Found it on amazon: https://amzn.eu/d/isFSJKm
1
u/Guantanamino Mar 31 '24
I recommend all of their books, they're usually pretty good, especially the Rust one, even if they are not completely comprehensive
1
u/zorbat5 Mar 31 '24
I have 4 books from them, the rust one, and 2 python ones and this C++ one. For C I have the K&R book.
3
u/the_poope Mar 31 '24
https://learncpp.com is all you need in the beginning. If you want a book and am completely new to programming then I recommend Bjarne Stoustrup's Programming: Principles and Practice using C++
1
1
u/snakecoffee2203 Apr 15 '25
It can be a good way to use chatgpt as a guide. You try to add more and more functionality to your project and on the way - espacially when learning - you have a tutor by your side that explains exactly what you want to hear.
1
u/bringer_of_carnitas Mar 31 '24
Spend about a day going through tutorials w3 schools is clutch, then try and build a game or somethin!
1
u/Flobletombus Mar 31 '24
Well technically you can do almost anything in almost any languages, you can even make a game or embedded with python. m
2
u/zorbat5 Mar 31 '24
Technically true, practically not really.
3
u/Flobletombus Apr 01 '24
Exactly, same thing for C++. You can make simple scripts with it but is it practical?
1
42
u/bringer_of_carnitas Mar 31 '24
All languages can do everything, that's called Turing complete. Wouldn't recommend cpp for web dev unless you hate yourself. The two big advantages are speed and manual memory management that makes it a great tool for performance critical apps like games or autonomous vehicle software. The manual memory management allows it to run in restricted environments like embedded devices. Some don't even have a heap!
But really if you're in high school, code whatever you want. Probably the language won't have an impact when you're learning. I find c++ to be quite pleasant:)