Programming Cplusplus C plus plus Basic | Programming Concept | part...

C plus plus Basic | Programming Concept | part – 1

-

This C plus plus basic concept will give readers an overview of what’s special about C plus plus. But it doesn’t provide a complete sense about the language itself.

The C++ evolves from the programming language C, and has overtime many development from its original definition. It has incorporated many features such as symbolic constants, inline function substitution, reference types, parametric polymorphism, and exceptions, which are not part of C. As a results, C++ has grown to be a complex programming language. C plus plus is also a powerful and flexible programming language. It shares C’s ability to deal efficiently with hardware at the level of bits, bytes, words, addresses, etc. In addition C++ adds several enhancements over C, with principle enhancement being the object-oriented concept of a class. 

The C plus plus basic |(C++/Cpp)

C plus plus is a compiled language, means to run a .cpp source file, it has to be processed by a compiler. The compiler produce the source file into an object file. The source file contains the source code, which basically a programmer type in IDE. Then another program, Linker, includes any requires library code function with the object file, and produce the final executable file. A linker is typically invoked automatically by the compiler.

C plus plus basic

The ISO C++ supports two kinds of entities:

  1. Core Language feature.
  2. Standard-Library components.

Features like built-in types (e. g. char, and int) and loops (for example, for statements, and while statements) are the core language features. 

An executable program is created for a specific hardware/system combination. This means, an executable program created for Windows can not run on MAC or LINUX. But when we talking about C plus plus’s portability, it refers to the portability of source code. A source code can be successfully compiled and run on variety of machines.

The standard library components are perfectly ordinary C plus plus code provided by every C++ implementation. So this means, the C++ standard library can be implemented in C plus plus code itself. It proves that C++ is sufficiently expressive and efficient for the most demanding systems programming tasks.

C plus plus is also a statically-typed language. Which means the type of every entity (such as, object, value, name, expression) must be known to the compiler at the point of their uses. The type of object indicates the set of operations, which is possible to perform on it.

A Simple C++ Program

#include <cstdlib>
#include <iostream>
/*This program output the sum of two numbers*/
void sum(int x, int y) {
int r;
r=x+y;
std::cout<<“summation of two numbers, ” << x<<y<<“: “<<r<<std::endl;
}

int main(){
sum(4,5);
return EXIT SUCCESS; // terminate successfully
}

Every C++ program must have exactly one main() function, which is a global function.  Therefore, every program starts with by executing the main() function. 

The line #include <iostream> instructs the compiler to include the declaration of the standard stream I/O facilities as found in iostream. Without this declaration std::cout makes no sense to the compiler. cstdlib indicates C++ standard library. 

The curly braces “{}” defines the function body. This “<<” indicates the output operator. The prefix “std::” indicates that the objects are from system’s standard library namespace. A return type void indicates the function doesn’t return any value.

//This is the end of discussion on the intro of C plus plus basic. Next we will talk about C++ Fundamental types.

To learn C++ I personally recommend two books to follow: 

C++ Primer (5th Edition) and  The C++ Programming Language

Books Recommended:

Latest Articles

Property Decorator | Getters Setters and Deleters in Python

In this article, we will talk about the Property Decorator in Python. It enables the class functionality...

Dictionaries | HashMap in Python | Working with Key-Values

Dictionaries in Python is similar to Hashmap comparing to other languages. It stores data as a key-value...

Hash Table | Indexing | Hashing Algorithm | Python Implementation

This article will talk about a high-level view of the Hash Table. As a programmer, this technique...

Eigenvector Eigenvalue | Linear Algebra Fundamentals

Eigenvector ($bar{v}$) in linear algebra is a non-zero vector (matrix) that doesn't change its direction during linear...

Pivot Table | Microsoft Excel | Create Data Insight Easily

Pivot table in microsoft Excel is an useful function that gives us a way to create insight...

Macro Function in Microsoft Excel | Automate Repetitive Task

This article we will talk about the Macro. It is a function in microsoft excel which basically...

Must read

Dictionaries | HashMap in Python | Working with Key-Values

Dictionaries in Python is similar to Hashmap...

You might also likeRELATED
Recommended to you