Skip to main content

How To Learn Any Programming Language Easily

Coding is not a Rocket Science which you'll find difficult to understand, it's simply like learning a new language to speak.

  • First, you need to understand the alphabet (for example a-z / A-Z ). 
  • Second, you need to learn some basic words and their meanings.
  • Third, Try to form sentences by combining those words.
  • Fourth, Repeat Steps Second & Third with a new set of words.
  • Fifth, Practice and Practice until you are comfortable with it.

The above-mentioned steps are nothing but an algorithm. An algorithm is a procedure that includes certain steps that help us to achieve the desired goal.

Above mentioned algorithm for a programming language can be written as :



  • First, you need to understand the alphabet supported by a language (for example ASCII ). 
  • Second, you need to understand what are it's keywords i.e. words with a pre-defined meaning. ( for example string, char, int, main, long, double, cout, cin, typedef, etc.)
  • Third, try to form meaning full statements example : 

  • ( ' //  ' : used for comments , ' ; ' used to terminate a statement )
    1. int a = 10; // variable a of type int is declared and initialized as 10
    2. cout<<a ; // print the value of variable 'a' on screen
    3. cout<<a+10; // print the value of variable a +10 on screen
    Once you are comfortable in  a declaration and initialization of variables then try some arithmetic manipulations on it.
    • All you need to do after that is practice and just practice.
    This algorithm I've tested and worked on any language will build your fundamentals and help you to achieve proficiency in any programming language.

    Some codes for you to practice :

    Example 1: Swap Numbers (Using Temporary Variable)

    #include <iostream>
    using namespace std;
    
    int main()
    {
        int a = 5, b = 10, temp; // variables
    
        cout << "Before swapping." << endl; // print statements
        cout << "a = " << a << ", b = " << b << endl;
    
        temp = a; // manipulation
        a = b;
        b = temp;
    
        cout << "\nAfter swapping." << endl;
        cout << "a = " << a << ", b = " << b << endl;
    
        return 0;
    }
    Output
    Before swapping.
    a = 5, b = 10
    
    After swapping.
    a = 10, b = 5

    Example: Print ASCII Value in C++

    #include <iostream>
    using namespace std;
    
    int main()
    {
     char c;
     cout << "Enter a character: ";
     cin >> c;
     cout << "ASCII Value of " << c << " is " << int(c);
     return 0;
    }
    
    Output
    
    Enter a character: p
    ASCII Value of p is 112
    
    When we explicitly print the integer value of a char type, it's corresponding ASCII value is printed.

    These were some simple programs, to begin with. In further posts, I'll be covering the STL.
    Happy Coding!!

    Comments

    Most Popular Posts

    Coding and Mathematics ( Importance Of Maths In Programming )

    Everyone wants to become a good coder but only a few manage to achieve this you know why? BECAUSE everyone wants to code and no one really wants to be a good mathematician which is the basic requirement to be a coder, yet very few know this fact and try to be a  mathematician first than a coder. What exactly is coding? It is the process of solving different technical problems using a programming language. The technical problems can vary from printing a  simple "Hello World" program to solving "2 SAT Problem" using mathematics. You might today be able to solve a few problems using your technical skills but it would help you in the long run only if you're fundamentals of mathematics are also clear. By mathematics, I don't mean the whole of it but some important topics such as Discrete Math, Algebra, Number Theory, etc. Here are some concepts of mathematics that you will use mostly in solving the technical problems : Fundamentals B...

    On Which Coding Platform Should I Practice?

    Which is the best online platform to practice, how to improve my coding skills? This post is all about giving answers to all such questions. If you're a beginner who has got no idea what programming is then I would recommend you step by step practice any programming language on Hackerrank. Hackerrank has modules that are self-explanatory and would slowly make you understand all the terminologies which are generally used and with practice, you'll be better at it. Moreover, if you're still not able to understand anything you can always search for your answers on GeekForGeeks or HackerEarth both of them provide one of the best tutorials on any topic. If you're an intermediate who's comfortable with any programming language then you can always improve your problem-solving skills studying Data Structures and Algorithms and practicing it. You can also improve by competitive coding. The best place to start with competitive programming according to me would be ...

    Left & Right View Of a Binary Tree Made Easy!

    When talking about binary trees then the view of a binary tree is something that has the most probability to be asked in a coding interview. In this blog post, I'm going to talk mainly about the Right & Left views of a binary tree. There are so many ways available on the internet, that it's really a very difficult task to choose which method you should follow. Suppose, you're using one method for Left View and another method for Right View, now you need to know two different methods for two similar questions. In this blog we'll discuss a single approach by which you can solve both Left View and Right View problems.   Before diving directly into the approach we need to understand what exactly is this Right/Left view. For your better understanding I've created a binary tree : So let's try to understand the right view for this binary tree. Right View simply means looking at the tree from its right side and the only nodes visible from that view are required to b...