You are on page 1of 9

1

Introduction to Programming [C++]


Lecture 03:
Introduction to C++
Learning Objectives
2

To know about:
History of C++
C++ coding environment
Writing first code in C++
Basic syntax of C++
History of C++
3

The C++ programming language has history going


back to 1979
Bjarne Stroustrup combined Simula67 and C to
develop C++
Originally called C with classes
Name was changed to C++ in 1983
C++ is a super set i.e. incremented version of C
History of C++…
4

C++ adds on to C the features classes, function


overloading, and operator overloading
These features enable to create
-Abstract data type,
-Inherit properties from existing data types,
-Support polymorphism
making C++ a truly object oriented language.
C++ Coding Environment (IDE)
5

An Integrated Development Environment (IDE) is a


software application that provides comprehensive
facilities to computer programmers for software
development. The most popular IDEs for C++ are
mentioned below:
Code::Blocks
Eclipse
CodeLite
NetBeans etc.
Writing First Code in C++
6

#include<iostream>
using namespace std;

int main(){

int a;
cin>>a;
cout<<"The number is : ";
cout<<a;

}
Basic Syntax of C++
7
Instructs the preprocessor to
#include<iostream> include a section of standard
C++ code, known as header
using namespace std; iostream, that allows to
perform standard input and
output operations.

int main(){ All the elements in the standard


C++ library are declared within
what is called a namespace:
the namespace std.

int a; In order to refer to the elements


in the std namespace a program
cin>>a; shall either qualify each and
every use of elements of the
cout<<"The number is : "; library (can done by prefixing
cout/cin with std::), or
Runtime library of C++ uses
cout<<a; the return value of the
main function() as the exit
introduce visibility of its
components. The most typical
way to introduce visibility of
return 0; code for the program, these components is by means
of using declarations
}
Basic Syntax of C++
8

#include<iostream>
using namespace std;
cin is a predefined object
that represents the standard
input stream. In C++
int main(){ >> is called extraction or
get from operator which
extracts the value from the
keyboard and assign it to the
int a; variable on its right

cin>>a;
cout<<"The number is : "; cout is a predefined object
that represents the standard
cout<<a; output stream. In C++
<< is called insertion or
put to operator which
inserts the contents of the
} variable on its right to the
object on its left
9

THANK YOU

You might also like