CONCEPT:

A program is a set of instructions a computer follows in order to perform a specific task. A programming language is a special language used to write computer programs.

What Is a Program?

Computers are designed to follow instructions. A computer program is a set of instructions that tells the computer how to solve a problem or perform a task.

Suppose we want the computer to calculate someone’s gross pay. Here is a list of steps the computer might do:

  1. Display a message on the screen asking “How many hours did you work?”
  2. Wait for the user to enter the number of hours worked. Once the user enters a number, store it in memory (Main Memory, i.e. RAM).
  3. Display a message on the screen asking “How much do you get paid per hour?”
  4. Wait for the user to enter an hourly pay rate. Once the user enters a number, store it
    in memory.
  5. Multiply the number of hours by the amount paid per hour, and store the result in
    memory.
  6. Display a message on the screen that tells the amount of money earned. The message
    must include the result of the calculation performed in step 5.

Collectively, these instructions are known as an algorithm. An algorithm is a set of well-defined steps for performing a task or solving a problem.

Calculate gross pay algorithm

Figure 1-1: Calculate gross pay algorithm

It is important that steps are sequentially ordered. Step 1 should be performed before step 2, and so forth. It is important that these instructions be performed in their proper sequence.

Programming Languages

There are two categories of programming languages:

  1. low-level
  2. high-level

A low-level language is close to the level of the computer, which means it resembles the numeric machine language of the computer more than the natural language of humans.

The easiest languages for people to learn are high-level languages. They are called “high-level” because they are closer to the level of human-readability than computer-readability.

Figure 1-2: High-level and low-level programming languages

A lot of high-level languages have been created during the passage of time. C++ is a widely used programming language because, in addition to the high-level features necessary for writing applications, such as payroll systems and inventory programs, it also has many low-level features.

C is the mother language of C++, which focuses on writing operating systems and compilers programs. Since C++ is the mature version of  C, it carries all of C’s low-level capabilities with it.

C++ is also popular because of its portability. You can write C++ program and run it on any platform/system. Some changes in the program or recompilation are required for successful execution on the required system.

 

Series Parts

Learn C++: Part 2 (coming soon)

Leave a Reply

Your email address will not be published. Required fields are marked *