How to Learn C++ Programming: 7 Steps (with Pictures)

Table of contents:

How to Learn C++ Programming: 7 Steps (with Pictures)
How to Learn C++ Programming: 7 Steps (with Pictures)

Video: How to Learn C++ Programming: 7 Steps (with Pictures)

Video: How to Learn C++ Programming: 7 Steps (with Pictures)
Video: How to Convert JPG to PDF on PC, iPhone & Android 2024, December
Anonim

Learning programming is definitely not something that can be done overnight, and requires a lot of hard work and dedication (especially learning C++). This guide will help you through the process.

Step

Learn C++ Programming Step 1
Learn C++ Programming Step 1

Step 1. Learn about the history of C++

The best way to start learning a programming language is to study its history. While you may not understand everything you read, these few pages will introduce you to important terms that will appear later (such as "Object Oriented Programming)".

Learn C++ Programming Step 2
Learn C++ Programming Step 2

Step 2. Install the C++ compiler (and possible IDE)

Compilers are necessary for programming in C++ because the actual source code must be compiled into an executable file by your computer. If you're using Windows, the right option is Visual C++ 2010 Express, or if you're using Linux, the right option is Geany. Both come with a built-in IDE (independent development environment), which can simplify the process of writing source code. (NOTE: Many people on the internet will recommend that you use the Bloodshed Dev-C++ IDE and compiler. But you should DON'T, this software hasn't been updated in 5 years and has many known bugs, the list is here: https://sourceforge.net/p/dev-cpp/bugs/)

Learn how to use an IDE efficiently. Some of the IDEs out there have their own personal quirks that can hinder your learning process. So it's a good idea to read through or keep a reference for various IDE options and settings

Learn C++ Programming Step 3
Learn C++ Programming Step 3

Step 3. Choose one or two tutorials to start learning C++

This step, along with installing the compiler, is one of the most important stages of all. There are a few things you should make sure of during this stage. First of all, make sure the guide is written for readers who are complete beginners in programming because the explanations are the most thorough. Next, make sure that the code in the tutorial follows the C++03 standard or even the new C++11 (not standardized yet, beware of compiler issues) because modern compilers will have a hard time compiling outdated code, or will simply reject it. Some good tutorials are the C++ tutorial from cprogramming.com and the tutorial at www.cplusplus.com/doc/tutorial/.

Learn C++ Programming Step 4
Learn C++ Programming Step 4

Step 4. Try each new concept

An important part of programming is not only reading about various concepts, but also using them in your own code. Copy-pasting code into the IDE is of little use. It is much more useful if you type in each example and even try to come up with your own program idea that uses the concepts taught to maximize the amount of information retained.

Learn C++ Programming Step 5
Learn C++ Programming Step 5

Step 5. Learn from other developers

One of the best things about programming is that no matter what level of expertise you have in programming, there will always be source code available for the same level or one level above you. A good way to learn from more complex source code is to read through until you get to a point you don't understand, then try to work it out in your head; if you don't know a certain part of the code, read about it in a tutorial or reference material until you understand.

Learn C++ Programming Step 6
Learn C++ Programming Step 6

Step 6. Solve the problem using the concepts that have been learned

The best way to retain what you learn is not just by writing source code examples, but by actually completing the assigned tasks. Both cprogramming.com and Project Euler have good problems you can try to solve to apply the concepts in real life. If you really can't come up with an algorithm for a problem, then as a last resort, look for solutions that have been done by others from the internet and learn from them. What's the point of solving problems if you don't learn from the results?

Learn C++ Programming Step 7
Learn C++ Programming Step 7

Step 7. Help others who need help

Now that you've learned about C++, you should start helping other beginners solve their problems online and get them on the same journey as yours! Don't be quickly frustrated if the person asking for help won't listen to your advice: others can learn from the answers you provide even if the original sender didn't.

Tips

  • Don't get frustrated quickly! Programming can be confusing at some points, but that doesn't mean you should throw all your progress away and quit! If a particular guide feels bad at explaining a topic, try reading another guide on the same issue; maybe the problem is not in you!
  • If you encounter errors while compiling, reread the source code and see if you can find any errors. While it may seem vague, the error itself will try to tell you what went wrong. So see if you can learn anything about mistakes from it.
  • Learn at your own pace.
  • You can learn C++ from the Google Play Store or Appstore by searching for "Learn C++".
  • You can also look for books on C++.
  • If you get an error when the program is run, then the problem is not a syntax problem, but a problem in your algorithm. Try to write down exactly what your algorithm is supposed to do, then compare it to your source code. Worst case scenario, take your code to an online community and see if they can find a problem for you. Make sure you ask politely! The people who help you take the time they could possibly spend programming money-making software to answer your questions. So, don't forget to say thank you!
  • Always comment your source code! There's nothing wrong with writing a brief description of the program's functions at the beginning, even for simple and self-explanatory code. This step is also a good habit to stick to later when you're programming large, confusing software that you may already understand, but other people reading are confused about.

Warning

  • C and C++ are low-level programming languages, meaning you have the opportunity to crash your computer with faulty code or with malicious programs on purpose! NEVER compile and run a program that has "#include " code in it unless you are REALLY SURE you know what it's doing. Even if you know what you're doing, try to avoid it at all costs.
  • Make sure your compiler and tutorials are up to date! Outdated compilers can cause valid source code to not compile or strange errors to occur at run time. The same goes for tutorials.
  • Many Antivirus will think that whatever you create is a virus! Make sure you add your program to the exception and maybe turn off the Antivirus to keep your program from being uninstalled!