SlideShare a Scribd company logo
1 of 12
C++: AN INTRODUCTION
Presented at the ICT Unit,
TV Gotel
By
Paul Lucky Bwaromale
WHAT IS C++?
C++ is an object-oriented High Level Language used in programming
awesome applications ranging from OS, scientific research software to
scheduler applications.
BRIEF HISTORY OF C++
In 1983, a Danish scientist Bjarne Stroustrup at the AT & T Bell
Laboratories improved a C simula which he researched and presented
as his Ph. D thesis.
He made his own version of C called “C with Classes” later renamed
C++ which has all the features and supports C libraries/syntax; and
new additions such as classes, derived classes, strong typing,
improved type checking, default arguments and many more.
FEATURES OF C++
HLL
Speed
Portability
Systems Progamming
Write-Only
C Library support
STRUCTURE OF A C++ PROGRAM
#include <iostream> preprocessor directives
Using namespace std;
int main()
{
//block of codes main
program
return 0;
}
VARIABLE DECLARATION IN C++
Rules
i. Unique name
ii. Appropriate datatype association
e. g. int x;
char z;
float r;
x, z and r are now variables that can be used in the program they are
declared.
C++ DATATYPES
 int (integer)
supports whole numbers ranging from -214783648 to 214782647
 double (double floating point)
best for numbers with decimal points
 float (floating point)
best for scientific mantissa figures
 char (Character)
supports all ASCII characters ranging from -128 to 127 or 0 to 255 for
signed and unsigned respectively
 bool (Boolean)
0 and 1
BASIC OPERATORS IN C++
<< - extraction
>> - insertion
+ - Addition
- - Subtraction
* - Multiplication
/ - Division
; - end of statement
// - single line commenting
/* */ - multiple line
commenting
|| - OR
&& - AND
< - Less than
<= - Less than or equal to]
> - Greater than
>= - Greater than or equal to
CONTROL STRUCTURES
Control structures are programming functions that alter the flow of a
program pending a condition been met. They are also called loops.
C++ control structures include
while
if – else
Nested ifs
elseif
For
switch
WHILE LOOP
It executes a block of code while a condition is met
e. g.
#include <iostream>
Using namespace std;
Int main()
{
int x=2;
while(x<10)
{
cout << “Welldone”;
}
return 0;
}
IF - ELSE
Executes a block of code if a particular
condition is met or executes another if the
conditions are not met
e. g.
#include <iostream>
using namespace std;
int main()
{
int x=2;
if(x<10)
{
cout <<“Less thsn 10”;
}
else
{
cout<<“Greater than 10”;
}
return 0;
}
NESTED IF
An if statement within an if statement
e. g.
#include <iostream>
Using namespace std;
int main()
{
int x ;
cin>>x;
if(x!=)
{
if (x<2)
{
cout << “not equal to 2”;
}
}
else
{
cout<<“Great number”;
}
return 0;
}

More Related Content

What's hot

Csc1100 lecture01 ch01-pt1
Csc1100 lecture01 ch01-pt1Csc1100 lecture01 ch01-pt1
Csc1100 lecture01 ch01-pt1
IIUM
 
Csc1100 lecture01 ch01-pt1
Csc1100 lecture01 ch01-pt1Csc1100 lecture01 ch01-pt1
Csc1100 lecture01 ch01-pt1
IIUM
 

What's hot (20)

First session quiz
First session quizFirst session quiz
First session quiz
 
C++ ch1
C++ ch1C++ ch1
C++ ch1
 
C++ io manipulation
C++ io manipulationC++ io manipulation
C++ io manipulation
 
C++ by shantu
C++ by shantuC++ by shantu
C++ by shantu
 
Console i/o for c++
Console i/o for c++Console i/o for c++
Console i/o for c++
 
Lecture 3 getting_started_with__c_
Lecture 3 getting_started_with__c_Lecture 3 getting_started_with__c_
Lecture 3 getting_started_with__c_
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5
 
Managing console
Managing consoleManaging console
Managing console
 
Managing console input
Managing console inputManaging console input
Managing console input
 
Whirlwind tour of the Runtime Dynamic Linker
Whirlwind tour of the Runtime Dynamic LinkerWhirlwind tour of the Runtime Dynamic Linker
Whirlwind tour of the Runtime Dynamic Linker
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
L6
L6L6
L6
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
 
Csc1100 lecture01 ch01-pt1
Csc1100 lecture01 ch01-pt1Csc1100 lecture01 ch01-pt1
Csc1100 lecture01 ch01-pt1
 
Csc1100 lecture01 ch01-pt1
Csc1100 lecture01 ch01-pt1Csc1100 lecture01 ch01-pt1
Csc1100 lecture01 ch01-pt1
 
Inline functions
Inline functionsInline functions
Inline functions
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTION
 
Managing console input and output
Managing console input and outputManaging console input and output
Managing console input and output
 
Assembly lab up to 6 up (1)
Assembly lab up to 6 up (1)Assembly lab up to 6 up (1)
Assembly lab up to 6 up (1)
 

Similar to C++: An Introduction

Abhishek lingineni
Abhishek lingineniAbhishek lingineni
Abhishek lingineni
abhishekl404
 
C++ programming: Basic introduction to C++.ppt
C++ programming: Basic introduction to C++.pptC++ programming: Basic introduction to C++.ppt
C++ programming: Basic introduction to C++.ppt
yp02
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
EPORI
 

Similar to C++: An Introduction (20)

Prog1-L1.pdf
Prog1-L1.pdfProg1-L1.pdf
Prog1-L1.pdf
 
Abhishek lingineni
Abhishek lingineniAbhishek lingineni
Abhishek lingineni
 
CPlusPus
CPlusPusCPlusPus
CPlusPus
 
C++ language
C++ languageC++ language
C++ language
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++ programming: Basic introduction to C++.ppt
C++ programming: Basic introduction to C++.pptC++ programming: Basic introduction to C++.ppt
C++ programming: Basic introduction to C++.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
 
C++
C++C++
C++
 
Introduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itIntroduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to it
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
C++ Programming
C++ ProgrammingC++ Programming
C++ Programming
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
C_plus_plus
C_plus_plusC_plus_plus
C_plus_plus
 
C++ Programming
C++ ProgrammingC++ Programming
C++ Programming
 
C++ basics
C++ basicsC++ basics
C++ basics
 

Recently uploaded

Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
drm1699
 

Recently uploaded (20)

Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...
Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...
Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
 
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
 
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AI
 
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
Auto Affiliate  AI Earns First Commission in 3 Hours..pdfAuto Affiliate  AI Earns First Commission in 3 Hours..pdf
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
 
GraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with GraphGraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with Graph
 
Rapidoform for Modern Form Building and Insights
Rapidoform for Modern Form Building and InsightsRapidoform for Modern Form Building and Insights
Rapidoform for Modern Form Building and Insights
 
Software Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringSoftware Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements Engineering
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdf
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
 
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
 
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
Test Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfTest Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdf
 
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit MilanWorkshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
 

C++: An Introduction

  • 1. C++: AN INTRODUCTION Presented at the ICT Unit, TV Gotel By Paul Lucky Bwaromale
  • 2. WHAT IS C++? C++ is an object-oriented High Level Language used in programming awesome applications ranging from OS, scientific research software to scheduler applications.
  • 3. BRIEF HISTORY OF C++ In 1983, a Danish scientist Bjarne Stroustrup at the AT & T Bell Laboratories improved a C simula which he researched and presented as his Ph. D thesis. He made his own version of C called “C with Classes” later renamed C++ which has all the features and supports C libraries/syntax; and new additions such as classes, derived classes, strong typing, improved type checking, default arguments and many more.
  • 4. FEATURES OF C++ HLL Speed Portability Systems Progamming Write-Only C Library support
  • 5. STRUCTURE OF A C++ PROGRAM #include <iostream> preprocessor directives Using namespace std; int main() { //block of codes main program return 0; }
  • 6. VARIABLE DECLARATION IN C++ Rules i. Unique name ii. Appropriate datatype association e. g. int x; char z; float r; x, z and r are now variables that can be used in the program they are declared.
  • 7. C++ DATATYPES  int (integer) supports whole numbers ranging from -214783648 to 214782647  double (double floating point) best for numbers with decimal points  float (floating point) best for scientific mantissa figures  char (Character) supports all ASCII characters ranging from -128 to 127 or 0 to 255 for signed and unsigned respectively  bool (Boolean) 0 and 1
  • 8. BASIC OPERATORS IN C++ << - extraction >> - insertion + - Addition - - Subtraction * - Multiplication / - Division ; - end of statement // - single line commenting /* */ - multiple line commenting || - OR && - AND < - Less than <= - Less than or equal to] > - Greater than >= - Greater than or equal to
  • 9. CONTROL STRUCTURES Control structures are programming functions that alter the flow of a program pending a condition been met. They are also called loops. C++ control structures include while if – else Nested ifs elseif For switch
  • 10. WHILE LOOP It executes a block of code while a condition is met e. g. #include <iostream> Using namespace std; Int main() { int x=2; while(x<10) { cout << “Welldone”; } return 0; }
  • 11. IF - ELSE Executes a block of code if a particular condition is met or executes another if the conditions are not met e. g. #include <iostream> using namespace std; int main() { int x=2; if(x<10) { cout <<“Less thsn 10”; } else { cout<<“Greater than 10”; } return 0; }
  • 12. NESTED IF An if statement within an if statement e. g. #include <iostream> Using namespace std; int main() { int x ; cin>>x; if(x!=) { if (x<2) { cout << “not equal to 2”; } } else { cout<<“Great number”; } return 0; }