Introduction

C++ is a general-purpose programming language created by Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significantly over time, and modern C++ now has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation. It is almost always implemented as a compiled language, and many vendors provide C++ compilers, including the Free Software Foundation, LLVM, Microsoft, Intel, Oracle, and IBM, so it is available on many platforms.

C++ is a cross-platform language that can be used to create high-performance applications. C++ was developed by Bjarne Stroustrup, as an extension to the C language. C++ gives programmers a high level of control over system resources and memory. The language was updated 3 major times in 2011, 2014, and 2017 to C++11, C++14, and C++17. Some features:

  • C++ is one of the world's most popular programming languages.
  • C++ can be found in today's operating systems, Graphical User Interfaces, and embedded systems.
  • C++ is an object-oriented programming language which gives a clear structure to programs and allows code to be reused, lowering development costs.
  • C++ is portable and can be used to develop applications that can be adapted to multiple platforms.

What you should already know

This guide assumes you have the following basic background:

  • A general understanding of the Internet and the World Wide Web (WWW).
  • Good working knowledge of HyperText Markup Language (HTML).
  • Some programming experience. If you are new to programming, try one of the tutorials linked on the main page about JavaScript.
C and CPP

C and C++ are kinda similar in pretty much every way. C is a function driven language because C is a procedural programming language. C++ is an object driven language because it is an object oriented programming. Function and operator overloading is not supported in C. Function and operator overloading is supported by C++.

Hello World

This will be your first written program ever:
#include <bits/stdc++.h> using namespace std; int main() {     cout<<"Hello World"<<endl; }

Variables

You use variables as symbolic names for values in your application. The names of variables, called identifiers, conform to certain rules. A Cpp identifier must start with a letter, underscore (_), or dollar sign ($); subsequent characters can also be digits (0-9). Because Cpp is case sensitive, letters include the characters "A" through "Z" (uppercase) and the characters "a" through "z" (lowercase).

Declaring Variables

You can declare variables like this:
int wx = 34; Or like this:
int wx(34); Or like this:
int wx; wx = 34;

Global variables

If you declare a variable outside the main function, that will be a global variable. An example for this:
#include <bits/stdc++.h> using namespace std;
int wx;
int main() {     wx = 34; }
Here wx is a global variable.

Constants

If you use 'const' keyword behind any variable, then it becomes constant. An example:
const int var = 34; 'var' will always be 34.

Data Types

Data types in C++ is mainly divided into three types:

  1. Primitive Data Types
  2. Derived Data Types
  3. Abstract or User-Defined Data Types:

References
Go to top