by Eeshan Baheti
C++ is immensely popular programming language which is an extension
to C programming language. It is particularly used for applications that require speed
and access to some low level features.
C++ is mainly used as a speedy language and it is used in making apps,
browsers, operating systems and making games. The game developers that
use unity use C# whereas game developers that use unreal engine,
the programming language C++ is must. It is also used to write graphical
programs which is also useful in graphic designing.
C++ is a very high level language and and also a very tough one to learn
with more understanding but I'll help you through my blogs so that you'll be
able to learn a high level language like C++ with ease.
It is very tough because C++ lacks consistency of coding as everything in C++
is case sensitive. This means that you'll have to take a look at the caps lock of
your keyboard when you're programming in C++.
Eg- someName in C++ is not the same as SomeName.
It is a high level language as it is very powerful and shorthands are sufficiently
expressive that you don't need to worry about the details of processor instructions.
C++ does give access to some lower level functionality than other languages.
Eg- memory addresses
HISTORY OF C++
Before the initial standardization of programming language of C++ in 1988,
it was developed by Danish computer scientist Bjarne Stroustrup in 1979 at bell labs.
It was first used as a set of extensions to the C programming language. He wanted
an efficient and flexible language similar to C that also provide high level
features for program organization.
ADVANTAGES OF C++
There are many advantages of C++ that it is used mostly everywhere, in making
browsers, games, apps, operating systems and also in writing graphic programs.
C++ programming language allow us to express common sequences of
commands more concisely. C++ provides some especially powerful shorthands.
Modifying code is easier in C++ as it is object oriented which further
improves maintainability.
One of C++ core strength is that it could be used to write
programs for nearly any processor whereas in other languages
the code should be translated into instructions for different processors.
SIMPLE CODE
In the tradition of programmers everywhere, they use "hello, world!" as an
entry point but I'll be using "Science King" instead of "hello, world!".
Here is a simple code of C++ -
1 // A Science King program
2 #include <iostream>
3
4 int main () {
5 std :: count << "Science King\ n";
6
7 return 0;
8 }
This was an example of a simple code of C++ which gives the
output as Science King.
TOKENS
Tokens are the minimal chunk of program that have meaning to the compiler -
the smallest meaningful symbols in the language. Our code displays all 6 kinds of tokens.
Here are the 6 tokens -
Keywords- Words with special meaning to the compiler.
Eg. int, double, for, auto
Identifiers- Names of things that are not built into the language.
Eg. cout, std, x, myFunction
Literals- Basic constant values whose value is specified directly in the source code.
Eg. "Science King", 18.5, 0, 'c'
Operators- Mathematical or logical operations.
Eg. +, -, &&, %, <<
Punctuations- Punctuation defining the structure of the structure of a program.
Eg. {}, (), (,), (;)
Whitespace- Spaces of various sorts which is ignored by compiler.
Eg. spaces, tabs, newlines, comments
So, these were the basic tokens used in C++ language.
Comments
Post a Comment