2024-03-14 19:53:30

Hello! What tools should i have or install to learn c++! Also, can anyone provide me a good website to learn c++?

2024-03-14 19:56:44

learncpp.com should be good.
if your willing to read books, you can read the c++ programming language book by Stroustrup, the c++ author himself. c/c++ compiler and a code / text editor should be good to get started

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2024-03-15 01:15:09

Do i need to install extra tools? Does Cpp need to be install?

2024-03-15 06:56:23

yes of course.
if your using windows, install Microsoft visual studio with desktop development with c++. option.
you can write the code in notepad and save it with .cpp. open a developer command prompt (you will get it after you install visual studio.).
then run cl file.cpp
with that said, please follow mainstream guides. they are very few guides which are inaccessible, at least about programming.

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2024-03-15 08:31:24

I don't know how to setup that visual studio. Do you have guide?

2024-03-15 09:01:02

i mean, in my openion, please learn how to understand self explanatory stuf. why dont you try downloading the installer and try on screen instructions, and if you still face any problems, then ask us?

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2024-03-15 23:20:40

Literally just follow the installer. You select the workloads you want, choose whether you want to download all components and install them or to download and install each component individually (I always choose to download all then install because IMO it's faster) and hit install. You can go to the individual components tab if you want to install more things that aren't in the individual workloads, but as a beginner to C++ you shouldn't need to. As said in prior posts, please use online tutorials or books to learn C++; I've yet to find a single book on C or C++ that is inaccessible, and I've got at least 15-20 books in my library on C and C++ alone, probably more than that. learncpp.com appears to be a good resource for getting started, just at a glance.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2024-03-16 06:20:06 (edited by bhanuponguru 2024-03-16 06:21:44)

@7
isn't the c++ programming language by stroustrup accessible? That book is epub and i feel it is accessible. again, learncpp is very good resource, but i never hurd this forum talking about stroustrup's book except that in the resources list you made.

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2024-03-16 06:22:20

@8, yes, I've read through parts of it and it's very good, though it covers.... C++14 if I remember right, and not any of the newer standards. Though the newer standards don't dramatically change C++ from what it was when the book was written, so C++14 would probably be just as good a starting point.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2024-03-16 11:02:22

@9
since we're at it I want to learn cpp but not sure, I have programming experience, from rust, and some C++, very, very tyny, barely, what confuses me mostly is the destructors and the ways how you can work around with operators, I remember people created some weird rules, the 0 rule, the 5 rule and a bunch of things, or was it called something else? Not sure, but those confused me so much, and recommendations? Will learncpp be enough?
also btw another C++ question always made me confused. When asining values, learncpp.com recommends using braces instead of =, why? Is there a reason? Or it's an old thing?

2024-03-16 12:43:20

@10
destructors are simple. if you have any members alocated on heap, we can use destructor to clear those allocated resources. you'll put your resource clearing code such as delete x; delete y; etc, and all cleanup code in destructors. then program will execute that code before destroying the object.
about operators, you overload it using a operator function followed by the operator?

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2024-03-16 13:23:20

@11
Yeah to be clear I get the simple concept of destructors, What I don't understand is all the rules, Do I need to worry about them? OR are they things just for optomozation freaks/(Useful but not required?)
example is this
https://www.geeksforgeeks.org/rule-of-five-in-cpp/
why I'm saying this is that from all the info I can gather cpp is a nightmare of memory mess leakage hells so I need to enter while knowing, because I like to learn a language the hard way, sort of, hard way while trying to avoid common mistakes at least.

2024-03-16 16:02:14 (edited by bhanuponguru 2024-03-16 16:04:35)

actually, i dont feel those are a must follow rules. those are probably made by some one from experience. you know? why would you even define functions outside a class which belongs to that class? especially memory management related functions outside a class is obviously a mess. since your telling you know rust, it shouldn't be hard for you to cleanly manage memory. in my openion, choose what is not messy for you from experience. those are just best practices made from people's experiences. again, i dont feel c++ is messy, you just need to understand memory management properly, which you probably would have since your rust programmer. also, for your code  to be readable for every one, reading open source code and getting an intuition on whhy are they doing it can be fine.

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2024-03-16 16:43:06

Hi guys. What is better: visual studio or visual studio code? Thx

Claudio

2024-03-16 16:58:40

Some of the destructor rules are things you need to always remember. For example, never, ever throw exceptions in destructors. Ever. That's undefined behavior. Some of the other rules are more obscure and your compiler should tell you if you've violated them.
As for initialization syntax, the braced initializer syntax does have some advantages; in particular, it forbids narrowing conversions. For example:

int x {7.9}; // Compile-time error: narrowing conversion because 7.9 is a double, but we're assigning to an integer, so we lose the .9
int x = 7.9; // Okay, better hope your compiler gives you a warning

The C++ core guidelines put it best: the {} syntax is simpler, more general, less ambiguous, and safer than the rules for other forms of initialization. The exception is when initializing things like vectors:

std::vector<int> x(10); // vector of 10 elements
std::vector<int> {10}; // Vector of one element with the value 10

There are a few other exceptions; see Rule ES.23 of the C++ core guidelines for more information.
In general however, if your just learning C++, a lot of this probably went over your head. Just use the braced initialization syntax. Don't worry about the why for now; much of it is quite complex and difficult to explain for new learners.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github