SlideShare a Scribd company logo
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

First session quiz
First session quizFirst session quiz
First session quiz
Keroles karam khalil
 
C++ ch1
C++ ch1C++ ch1
C++ by shantu
C++ by shantuC++ by shantu
C++ by shantu
Shant007
 
Console i/o for c++
Console i/o for c++Console i/o for c++
Console i/o for c++
Darshan Radadiya
 
Lecture 3 getting_started_with__c_
Lecture 3 getting_started_with__c_Lecture 3 getting_started_with__c_
Lecture 3 getting_started_with__c_
eShikshak
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5
Motaz Saad
 
Managing console
Managing consoleManaging console
Managing console
Shiva Saxena
 
Managing console input
Managing console inputManaging console input
Managing console input
rajshreemuthiah
 
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
Gonçalo Gomes
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
Waqar Younis
 
L6
L6L6
L6
lksoo
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
Maryala Srinivas
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
Motaz Saad
 
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-pt1IIUM
 
Inline functions
Inline functionsInline functions
Inline functions
DhwaniHingorani
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTION
Anil Pokhrel
 
Managing console input and output
Managing console input and outputManaging console input and output
Managing console input and output
gourav kottawar
 
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)
ilias ahmed
 

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

Prog1-L1.pdf
Prog1-L1.pdfProg1-L1.pdf
Prog1-L1.pdf
valerie5142000
 
Abhishek lingineni
Abhishek lingineniAbhishek lingineni
Abhishek lingineniabhishekl404
 
CPlusPus
CPlusPusCPlusPus
CPlusPus
rasen58
 
C++ language
C++ languageC++ language
C++ language
Hamza Asif
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
Dikshithkumar10
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
EPORI
 
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
JayarAlejo
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
Infotech27
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
TeacherOnat
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
JayarAlejo
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
Thooyavan Venkatachalam
 
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
PushkarNiroula1
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
somu rajesh
 
C++ Programming
C++ ProgrammingC++ Programming
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
Sangharsh agarwal
 
C++ Programming
C++ ProgrammingC++ Programming
C++ Programming
Rounak Samdadia
 
C++ basics
C++ basicsC++ basics
C++ basics
AllsoftSolutions
 

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++_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++ 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

Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 

Recently uploaded (20)

Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 

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; }