➤ Hello World! in C++
➤ Print Number in C++
➤ Add 2 Numbers C++
➤ Arithmetic Operation
➤ Sum Avg of 3 Number
➤ Area Program in C++
➤ Simple Interest in C++
➤ Find ASCII value in C++
➤ Swap 2 Number in C++
Flow Control Programs
➤ Even-Odd in C++
➤ +ve, -ve, 0 in C++
➤ Vowel-Consonant
➤ Greatest of 3 no.
➤ Check Leap Year
➤ Calculator Program
➤ Reverse a Number
➤ Sum of Natural Number
➤ GCD of 2 Number
➤ LCM of 2 Number
➤ Find Power in C++
➤ Fibonacci Series in C++
➤ Palindrome Number
➤ Find Factorial in C++
➤ Factorial Using Recursion
➤ Prime Number in C++
➤ Prime Number b/w 1-N
Array
➤ Linear Search in C++
➤ Binary Search in C++
Others
➤ Introduction to C++
➤ Data Types in C++
➤ Range of Data Types
➤ Void main, main vs int main
Introduction to C++ programming language. What is the C++ language? Who developed the C++ programming language? In this tutorial Introduction to C++ language, you will learn Different versions of C++ programming language, C++ applications, how to compile and run C++ programs, and how to write hello world program in C++ programming language.
C++ is a general-purpose, High level, Compiled based and object-oriented programming(OOP) language, developed by Bjarne Stroustrup in AT&T Bell Labs. The C++ language is an extended version of C Programming Language, and it is pronounced as “C-plus-plus”. C and C++ are often denoted together as C/C++.
The C++ programming language is considered to be an intermediate-level language, as it encapsulates both high- and low-level language features. Initially, the language was called “C with classes” as it had all the properties of the C language with an additional concept of “classes.” However, it was renamed C++.
Different versions of C++
C++ Applications
There are a lot of things that can be designed using the C++ programming language.
- Operating System:- Linux , Windows, Apple(OS X) e.t.c
- Text Editor:- Notepad, Wordpad, Editplus e.tc
- Database:- Oracle, SQL Server, MySQL e.t.c
- Translator:- Compiler, Interpreter, Assemble e.t.c
- Protocols:- HTTP, FTTP, e.t.c
- Commercial Application:- Bank, Super Market, Hotel Management program e.t.c
- Device Drivers:- Drivers of Mouse, Printer, Keyboard e.tc
- PC and Mobile games
Many Other systems, applications, and, libraries are completely or mostly written in C++. Facebook, Adobe Systems, Amazon, Google, Chromium Browser, Google File system, Mozilla (Firefox browser and Thunderbird mail client) are
The translator converts source code to object code. Compiler, Interpreter and, Assemble are an example of a Translator. Compiler & Interpreter converts the high-level language to machine code, Assemble converts the low-level language to machine code.
We use Compiler as a Translator for C++. Therefore, C++ is also called as a compiler-based programming language.
For Protocols, C++ used Especially. Whenever we open a website, automatically it starts with HTTP (HyperText Transfer Protocol), HTTP designed with C++. Similarly, C++ is also used to design FTP (File transfer protocol) and Bluetooth transfer protocols. In short, 90% of telecom protocols are designed using C++ Programming Language.
Compile and Run C++ Programming
C++ Programming language can be run online. There are various Websites that allow running C++ online. Some websites are ideone.com, C++ Shell. But, there are some limitations to online compilers like we can’t work with files.
Its recommended to install a compiler and run C programs from the system to unlock the full potential of C++.
To run C++ Programming in Windows you can use Code: Blocks IDE. For this, go to the official website of Code: Blocks, and download it.
Developing C++ Program in Linux OS
Code: Blocks IDE is also available for Linux. The best approach for Linux is to compile and run using the terminal. For this purpose, we need a compiler, development tools & libraries, and a text editor.
$ sudo apt-get update
$ sudo apt-get install gcc
This installs GNU GCC compiler and related tools on your system.
We may also run the below command,
$ sudo apt-get install build-essential
This command will install all the libraries which are required to compile and run a C++ program.
Issue the below command to verify GCC compiler is installed properly or not,
$ gcc --version
Write any C++ Program using any text editor and save it .cpp
.cpp
These command compile program.
$ g++ program.cpp -o program
To see the output use the following command,
$ ./program
Note:- Shortcut to compile C++ program in terminal (Linux)
For compilation, This command creates an executable file named a.out$ g++ program.cpp
Execute it,$ ./a.out
Introduction to Hello World! Program in C++
In every programming language, we start our journey by writing the hello world program. In this tutorial Introduction to C++ programming language, you will learn how to write a program to display “Hello World” to the screen. The below program displays “Hello World” to the screen.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!";
return 0;
}
Output:-
Hello World!
How this program works,
#include <iostream>
This line includes iostream
#include
iostream
is a standard C++ input/output library file.
using namespace std;
This line tells the compiler that we "using"
"namespace" "std"
If we hadn’t used the namespace
, we had written std::cout
instead of cout
. This tells the compiler that every cout
is actually std::cout
.
A ;
int main() {}
This line declares a function main
which returns integer data. Every C++ program must have a main function. Execution of every C++ program starts from the main function. The code inside {}
is called the body of the main function, the opening braces ‘{‘ indicates the opening of the main function and the closing braces ‘}’ indicates the end of the main function.
cout << "Hello World!";
This line tells the compiler to display the message Hello World!
return 0;
This is the return statement used to return a value from a function and indicates the finishing of a function.
If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or do you find anything incorrect? Let us know in the comments. Thank you!