How to Learn to Program in C ++: 7 Steps

Table of contents:

How to Learn to Program in C ++: 7 Steps
How to Learn to Program in C ++: 7 Steps
Anonim

Learning to code isn't something you can do in a day, and it takes hard work and dedication - especially with C ++. This guide will help you through the process.

Steps

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

Step 1. Get to know the history of C ++

The best way to start programming in a language is to know its roots. While you may not understand everything you are reading, some of these passages will introduce you to some important terminology that you will need later (such as "Object-oriented Programming").

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

Step 2. Install a C ++ compiler (and possibly an IDE)

You need a compiler for programming in C ++, since the source code must be compiled into a file that your computer can run. If you use Windows, a good option might be Visual C ++ 2010 Express, or Geany if you use Linux. Both include an independent development environment (IDE), which can make the code writing process easier. Note: Many people online recommend using Bloodshed Dev-C ++ IDE and compiler. DO NOT, it hasn't been updated in the last 5 years and there are pages and pages of known bugs, listed at this link.

Learn how to use an IDE effectively. Some IDEs that are out there have their own peculiarities that could make some tasks easier for you, so it is advisable to read the guide of the different options and settings of your IDE or to keep a reference

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

Step 3. Choose a tutorial or two to learn how to use C ++

This step, along with that of the compiler, is one of the most important. There are a couple of things you need to make sure at this point. First of all, make sure the guide is written for complete programming newbies, as they are the ones that provide the most comprehensive descriptions. Then, make the tutorial code follow the standard C ++ 03 or even the new C ++ 11 (still not standardized, so there may be some compiling problems), as modern compilers will have trouble compiling the outdated code, or they will simply reject it. Some suitable tutorials are that of the cprogramming.com website and that of the website 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 just reading about the different concepts, but using them within your code. Copying and pasting some code into your IDE won't give you any added value. It is much more beneficial to write each example and also create your own ideas-based programs that use the concepts you are learning to maximize the amount of information stored.

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

Step 5. Learn from other programmers

One of the best things to do about programming is that no matter what your programming level, there will always be source code available that is at the same level or a little higher. A good way to learn from the more complicated source code is to read it until you get to a point you don't understand, and then try to work it out in your own mind; if you are unfamiliar with a particular portion of the code, read about it in your tutorial or reference material.

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

Step 6. Address the problems using the concepts you have learned

The best thing to keep in mind what you have learned is to not just write code examples, but do a variety of operations with them. Both cprogramming.com and Project Euler have good problems that you can try to solve by applying the concepts to real-life situations. If you absolutely can't create an algorithm for a problem, at least search online to find an example from someone else and learn from that. What's the point of solving problems if you don't learn from the result?

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

Step 7. Help others who need help

Now that you've learned C ++, you should start helping other newbies online with their problems and getting them started on the same path you did! Don't be frustrated if the people asking you for help don't want to listen to your advice - someone else may learn from the answers you gave, even if the person who wrote the post didn't.

Advice

  • Always comment on your source code! Even for simple, self-explanatory code, it never hurts to write a short explanation of the program's features at the beginning. It is also a good habit to put them inside when you are programming large and confusing software, which you may understand later, but could create problems for anyone else who wants to read it.
  • Don't be frustrated! Scheduling can be confusing in some cases, but it definitely doesn't mean you just have to throw away all your progress and quit! If a particular guide doesn't explain a topic well, try to read another one; you may not have the problem!
  • If you get errors when launching the program, there is a syntax error in your algorithm. Try to write down exactly what your algorithm should do, then compare it to your source. In the worst case, enter your code in an online forum and see if they can find the problem for you, but be sure to ask politely! The people they are helping are spending their time on you - which they could use to program software and make money instead of answering your questions - so be grateful!
  • If you get errors when compiling, please review the source code and see if you can find the errors. While the error messages may seem cryptic, they are trying to tell you what is wrong, so see if they allow you to understand anything about the error.

Warnings

  • Make sure your compiler and tutorial are up to date! Outdated compilers may not compile correct source code and give strange errors in execution. The same can be said of the tutorials.
  • C and C ++ are low-level programming languages, in the sense that you have the possibility of ruining your computer with wrong code or programs that are intentionally malicious! Make sure you NEVER compile or run programs that have "#includes" in them, unless you are COMPLETELY SURE what you are doing, and even if you know exactly what you are doing, try to avoid it at all. cost.