In: Computer Science
For each selected language, your report must shortly review its historical background, an overview of its main features (such as data type, operations, potential application areas, etc. ), an evaluation that must include a short program written in the programming language you are introducing.
The Selected language is C++.
The C++ programing language was was developed in the year 1979 as an extension of the existing C language by Bjane Stroustrup. His goal was to develop a high-level, feature rich language which was on the same lines as the existing C language.
Main notable additions were function overloading, virtual functions, referencing operator, etc.
Data types:
Fundamental data types supported by C++ are:
Integer (int) - byte size = 2 or 4
Floating point (float) - byte size = 4
Double floating point (double) - byte size = 8
Character (char) - byte size = 1
Boolean (bool) - byte size = 1
Void - byte size = 0
Integer type variable can store values from -2147483648 to 2147483647.
Double type variables have double the precision compared to that of Float type variables.
Boolean type variables can store either true of false values.
Void data type indicates the absence of data.
Some modifiers that can be used along with integer, double and character are:
Long
Short
Signed
Unsigned
C++ supports a wide range of operators such as:
Arithmetic operators
Assignment operators
Comparison operators
Logical operators
Arithmetic operators consists of:
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
++ Increment
-- Decrement
Some assignment operators are:
+, +=, -=, /=, *=, ^=, &=
Comparison operators consists of:
== Equal to
!= Not equal to
> Greater than
< Less that
>= Greater than equal to
<= Less than equal to
Logical operators are:
&& Logical AND
|| Logical OR
! Logical NOT
C++ has a potential use in the follow fields:
1 Gaming industry
2 GUI based interactive applications
3 Database server connectivity
4 Advance graphics and computation
5 Browser development
6 Embedded systems
Program to add two numbers using C++
#include<iostream.h>
#include<studio.h>
using namespace std;
void main() //main function
{
Int a,b,sum=0; //declaring variables
cout<<"Enter the first value to be added";
cin>>a; //input from user
cout<<"Enter the second value to be added";
cin>>b;
sum=a+b;
cout<<"The sum is "<<sum;
}