Introduction to C ++ Programming

This article gives you an introduction to ground level C ++ programming.
This article will not teach you all the basics of C ++ programming instead
You are a rule to learn C ++ programming, remember that for more learning,
The base should be strong and this is what this article is trying to do. Will allow
You know many fundas that will help you in further learning of the language.
C ++ was developed in the 1980s in Bell Laboratories by Bjarne Stroustrup
Object Oriented Programming Language. This language is considered by many
C. Programming language extension. Programming language extension
C is obtained to create C ++ by adding classes to C. This is why C ++ was tentative
It is called "C with classes". C ++ programming language
The name of the increment operator used in C, which increases the value of the variable.
The symbolic name of C ++ rightly indicates that this language is an enhanced version
From Jim

Features
C ++ programming language: –

  1. The C ++ programming language is very flexible and is a very versatile and very powerful programming language for developing any software special system system, i.e. operating system, compilers, etc.
  2. C ++ is the ideal language for reusable software development, which is very important to keep minimum production cost.

Compare the C ++ programming language

Let's see how C ++ compares
With other programming languages. All programming languages ​​can be divided
Into two categories: –

  1. Problematic languages ​​or high-level languages: These languages ​​are designed to provide better programming efficiency, that is, to develop faster software. Examples of the languages ​​that fall into this category are FORTRAN, BASIC etc.
  2. Machine-oriented languages ​​or low-level programming languages. These languages ​​are designed to provide better machine efficiency, that is, to execute the program faster. Examples of programming languages ​​that fall into this category are assembly language and machine language.

C ++ stands between these two categories. For this reason it is often called
Middle level language, because it was designed to be both: relatively good
Efficient programming (compared to machine-oriented languages) and relatively
Good machine efficiency (compared to problem-oriented languages).

Getting started with C ++ programming

Communicate with
The computer involves speaking the language that the computer understands, and that immediately
Excludes English as computer language. Whatever is here
It is a close analogy between learning English and learning C ++.
The classic way to learn English is first to learn alphabets or letters
Used in the language, then learn to combine these alphabets to form sentences
The sentences are combined to form vertebrae. Learning C ++ programming is similar
And much easier.

So, instead of learning directly about how to write programs, we must first
Learn about the alphabets, numbers, and special symbols used in C ++, then how to use them
These constants, variables and keywords are built, and finally how it is done
All of these combined to form instructions. A set of instructions will be combined
Later to form a program. Character set A character set is a group
Of valid characters that the language can recognize. A character represents any
Letter, number, or any other sign. C ++ contains the following character set:

Messages from A to Z, from A to Z

The numbers 0 through 9

Special characters space + – * / & # 39; "() () etc.

White blanks, blank space, horizontal tab, cart return, new font etc.

Other characters, C ++ can handle any of the 256 ASCII characters as data or as such
The craft.

Alphabets, numbers, and special symbols when integrating form constants correctly,
Variables and keywords. Let's see what these are: –

  • Constants: Constants are data elements that never change their value while running a program. C ++ allows several types of constants.
  • Variables: Variables are the quantities that may vary during program implementation. Variable names are names given to locations in the computer's memory where the value is stored.
  • Key words: These are the words that transfer special meaning to the language translator. Keywords are words that have already been explained to the C ++ compiler. Keywords cannot be used as variable names because if we do this, we try to assign a new meaning to the keyword, which is not allowed by the computer. Examples of keywords are: if, void, for, switch, etc.

Types of data in C ++

Data types are a way to define types
Data and processes associated with it to deal with it. In C ++ data types, it is widely available
Of two types: –

  1. Basic data types: This is preset for the C ++ language itself. There are at least five basic data types.
    • Char represents that the declared variable of this type can store characters
    • Int represents integers
    • float – represents floating point numbers
    • Void – represents data of no value
  2. Derived data types: These are constructed from the basic species. I will not give you details here because this level is a little high.

Help in C ++ programming language

Now that we have seen
Different types of constants, variables, and keywords are the next logical step
To see how they are combined to form instructions.

  • Type declaration instructions: To announce the type of variables used in the program. For example: – Number of cylinders Here the int (eger) cylinder variable is declared.
  • Input / output instructions: To perform the function that provides the data entry program and obtain the output results from it. For example: – O >> A; cout On the first line, input is taken from the keyboard by the cin function, and it is set to a previously declared variable. The second line 'Hello' is printed using the cout function.
  • Calculation instructions: To perform the calculation between constants and variables. For example: – C = a + b; Here the value of c is set, which is the sum of the variables a and b.
  • Control instructions: Controls the sequence of execution of different statements in C ++. For example: – If (a> b) func1 (); Here it is verified if a is greater than b, if it is, then the program execution moves to a user-defined function 'func1'.

The first C ++ program

Armed with knowledge about
Types of variables, constants, keywords, etc.
a program.

Each C ++ instruction will consist of a series of statements. this is
The data should appear in the order in which we want to implement it.

The following rules apply to all C ++ programs regardless of long or complex duration
They are

  • Blank spaces can be inserted between two words to increase phrases readability. However, blank spaces are not allowed within a variable, constant, or keyword.
  • All data is usually entered in small letters.
  • C ++ does not have specific rules for where the manifest will be written. For this reason it is often called a free-form language.
  • Any C ++ statement always ends with a semicolon (;).

Now, let's take a look at a program that computes the sum of two specific numbers
By the user.

// To calculate the sum of two specific numbers

#Include

the basic ()

{

Number of cylinders 1; // announce the num1 type int (etger)

Number of cylinders 2; // announce the num2 type int (etger)

int // declares the sum of the variable type int (etger)

O >> num1; // takes inputs and stores to var num1

O >> num2; // takes inputs and stores to var num2

sum = num1 + num2; // adds vars num1 & num2

cout

Some helpful advice: –

  • A C ++ program is nothing but a set of functions, main () is one of these functions that is always present in C ++ in one way or another. Empty brackets are necessary after the main.
  • A set of data belonging to a function is included within a pair of the previous two brackets. main () {statement1; statement2. statement3. statement4. }
  • Any variable is declared before use.
  • Any C ++ statement must always end with a semicolon.
  • iostream.h is the file required to use the cin and cout functions, and is included in the program with the keyword "include".

Summary

After reading the article, I got it
Introduction to C ++ programming, you now know what C ++ is and how it is used.
You now know C ++ and have learned some basic parts
From C ++. You learned how to declare variables and how to use them in calculation
Operations. In one sentence you have an introduction to C ++ programming
It will help you in further learning the language.

&

    Leave Your Comment

    Your email address will not be published.*