0% found this document useful (0 votes)
13 views

CPP Codes

Uploaded by

moxida2615
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

CPP Codes

Uploaded by

moxida2615
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Natural language vs programming language

A language is a tool for expressing and recording human thoughts or a mechanism known to us and to our
partners.

A programming language is defined by a certain set of rigid rules, much more inflexible than any natural
language. The rules determine which symbols (letters, digits, punctuation marks, and so on) could be used
in the language is called lexicon. Whereas Another set of rules determines the appropriate ways of collating
the symbols - this is the syntax of the language. The main task is to write a program in accordance with the
rules of the chosen programming language. Such a program (which in fact is just text) is called the source
code, or simply source, while the file which contains the source is called the source file. The phase of
"gluing" the different executable codes is commonly known as linking, while the program that conducts the
process is called a linker.

Machine Language is mother tongue of computer. A complete set of well-known commands is called an
instruction list, sometimes abbreviated to IL. The IL is in fact an alphabet that is commonly known as
machine language. Programs written in machine language are very difficult to understand for humans.

An intermediate common language for both humans and computers working together. Such a language is
often called a high-level programming language. The programs written in high-level languages can be
translated into any number of different machine languages, and thus enable them to be used on many
different computers. This is called portability.

Translator – compiler (Process is known as compilation)

The type of structured & semi-formal description of each step of the program is called as algorithm.

# - Preprocessor Directive

The characteristic of a number that determines its type, range, and usage is known as its type. If an integer
starts with the digit 0, it's interpreted as an octal value. This means the number should only contain digits
between 0 and 7. A hexadecimal number should be preceded by the prefix 0x or 0X. Binary numbers,
indicated by the prefix 0b or 0B.

An operator is a symbol of the programming language, which is able to operate on the values. The
phenomenon that causes some operators to act before others is known as the hierarchy of priorities. The
C++ language precisely defines the priorities of all operators and assumes that operators of larger (higher)
priority perform their operations before the operators with lower priority. The binding of the operator
determines the order of computations performed by some operators with equal priority, put side by side in
one expression. Most operators in the C++ language have the left-sided binding, which means that the
calculation of this sample expression is conducted from left to right. Subexpressions in parentheses are
always calculated first.

Highest to the lowest priority

+ , -, ++, -- unary
*/%
+- Binary
=
< <= > >=
== !=
= += -= *= /= %=
ASCII – American Standard Code for Information Interchange ( 256 characters but 128 are primary) space is
at 32 where lower case starts at 97 and upper case latter starts at 65, where difference between code ‘a’
and ‘A’ is 32.

 long – is used to declare that we need a wider range of ints than the standard one;
 short – is used to determine that we need a narrower range of ints than the standard one;
 unsigned – used to declare that a variable will be used only for non-negative numbers; this might
surprise you, but we can use this modifier together with the type char; we’ll explain it soon.

Char

 You're not allowed to omit the word char;


 You can use the signed modifier in conjunction with int, long, and short, but it will change nothing in
the variable's life (nothing unusual);
 Don't try to put signed and unsigned side by side in the same declaration, as the variable will suffer
from split personality (it's a joke, of course - as compilers show no sense of humor at all, we have to
make up for this lack).

An instruction or instructions executed inside the loop are called the loop's body. The body should be able
to change the condition value, because if the condition is true at the beginning, the body might run
continuously to infinity

You might also like