SlideShare a Scribd company logo
BASICS OF C++BASICS OF C++
Programming…Programming…
What is C++?
C++ (pronounced cee plus plus / si pl sˈ ː ʌ
pl s/) is a general-purpose programmingʌ
language. It has imperative, object-oriented
and generic programming features, while
also providing facilities for low-level memory
manipulation.
When was C++ Created?
Before the initial standardization in 1998, C+
+ was developed by Bjarne Stroustrup at
Bell Labs since 1979, as an extension of the
C language as he wanted an efficient and
flexible language similar to C, which also
provided high-level features for program
organization.
For What Purpose C++ is
used?
C++ is one of the most versatile languages
in the world. It is used nearly everywhere for
everything… systems programming
(operating systems, device drivers,
database engines, embedded, Internet of
Things, etc.)
What is the C++ Program?
C++ is an object oriented programming
(OOP) language, developed by Bjarne
Stroustrup, and is an extension of C
language. It is therefore possible to code C+
+ in a "C style" or "object-oriented style."
Structure of C++ Program:
The format of writing program in C++ is
called its STRUCTURE.
It consists of the following parts:
•Preprocessor directive
•Main() Function
•Program Body
Preprocessor Directive:
Preprocessor Directive is an instruction
given to the compiler before the execution of
actual program. Preprocessor directive is
also known as Compiler directive.
The preprocessor directive start with “Hash”
symbol ‘#.’
Include preprocessor :
Include preprocessor directive is used to
include header files in the program.
Syntax:
#include <iostream.h>
What are Header Files?
Header files contain definitions of Functions
and Variables, which is imported or used
into any C++ program by using the pre-
processor #include statement. Header file
have an extension ".h" which contains C++
function declaration and macro definition.
Syntax of Header files:
The syntax of header files is as follows:
#include <header_file_name>
Name of header file can also be used in
double quotes as follow:
#include “header_file_name”
Example:
#include <iostream.h>
The word “iostream” stands for input/output
stream. This header file contains the
definitions of built-in input and output
functions and objects.
main() Function:
The main() function is the starting point of a
C++ program. Each program must contain
main() function. If a program does not
contain main function, it can be compiled but
cannot be executed.
Syntax of main() function:
The syntax of main() function is as follows:
void main()
{
body of main function
}
Example:
The following example explains the basic
structure of C++ program:
#include<iostream.h> Preprocessor
void main() Main function
{
cout<<“Hello world”; Body Statement
}
What is Data Type in C++?
A Datatype actually describes you data like
what form of data you want to create (It may
be integer, character, floating point
number, string etc.) In the context of C++,
you can make many types of data that are
mentioned above.
Cont..
To make integer datatype, you type int and
then write its name (called variable name).
To create floating point datatype , you type
float and then write its variable. That is
actually a syntax of C++. (It may differ for
other languages).
Cont…
• int- integer, it is of 2 or 4 bytes dependent
on machine.
• char- character type (used to store
characters and strings), one byte.
• float- used to store floating point numbers,
4 bytes.
• double- used to store high precision
floating point numbers, 8 bytes.
Variables:
A Variable is a named memory location or
memory cell. It is used to store program`s
input data. The value of variable may
change during the execution of program.
However, the name of variable cannot be
changed.
How variables created?
The variables are created in RAM. RAM is a
temporary memory. That is why the data
stored in variables is also temporary.
The data stored in the variable is
automatically removed when program ends.
Variable Declaration:
The process of specifying the variable name
and its type is called “Variable
Declaration”.
Syntax:
data_type variable_name;
Example:
int marks;
float average;
Variable Initialization:
The process of assigning a value to a
variable at the time of declaration is known
as “Variable initialization”.
The equal sign ‘=‘ is used to initialize a
variable. Variable name is given on left side
and value is given on the right side of equal
sign.
Syntax:
The syntax of initializing a variable is as
follows:
data_type variable_name =value;
Example:
int n =100;
float a=50.73;
What are Operators?
An operator is a symbol that tells the
compiler to perform specific mathematical or
logical manipulations. C++ is rich in built-in
operators and provides the variety of
operators: Arithmetic Operators. Relational
Operators.
Cont…
The operators can be categorized as follow:
Unary Operator:
A type of operator that works with one
operand is known as unary operator.
Example:
-,++,--, -a, N++, --x
Cont…
Binary Operator:
A type of operator that works with two
operands is known as Binary Operator.
Example:
+,-,*,/,%
a + b;
x/y;
What are Arithmetic
Operator?
C++ uses operators to do arithmetic. It
provides operators for five basic arithmetic
calculations: addition, subtraction,
multiplication, division, and taking the
modulus. Each of these operators uses two
values (called operands) to calculate a final
answer
Example..
Suppose we have 2 variables A & B where
A=10 & B=5. Arithmetic operation can be
used on A & B as follows:
Operations Result
A + B 15
A - B 5
A * B 50
A / B 2
A % B 0
What is Relational operator?
• In computer science, a relational
operator is a programming language
construct or operator that tests or defines
some kind of relation between two entities.
These include numerical equality (e.g., 5 =
5) and inequalities (e.g., 4 ≥ 3).
Assignment Statement:
A statement that assigns a value to a
variable is known as “Assignment
Statement”.
Syntax:
Variable = expression;
“=” is the assignment operator.
Example:
A=100;
C=A+B;
Compound Assignment
Statement:
An assignment statement that assigns a
value to many variables is known as
“Compound Assignment” statement.
Example:
A=B=10;
x = y= z= 100;
Compound Assignment
Operator:
C++ language provides Compound
Assignment operator that combines
assignment operator with arithmetic
operators.
Syntax:
Variable op=expression;
Example:
N+=10; is equivalent to N=N+10;
Increment Operator:
The increment operator is used to increase
the value of a variable by 1. It is denoted by
the symbol “++”.
Increment operator can be used as follows:
•Prefix form
•Postfix form
Prefix & Postfix Form:
In Prefix form, the increment operator is
written before the variable as follows:
++y;
In Postfix form, the increment operator is
written after the variable as follows:
y++;
Decrement Operator:
The Decrement operator is used to
decrement the value of a variable by 1. It is
denoted by the symbol “—”.
Decrement operator can be used in two
forms:
•Prefix form
•Postfix form
Prefix & Postfix Form:
In prefix form, decrement operator is written
before the variable as follows:
--y;
In postfix form, decrement operator is
written after the variable as follows:
y--;
Basics of c++

More Related Content

What's hot

C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language Mohamed Loey
 
Introduction to C++
Introduction to C++ Introduction to C++
Introduction to C++ Bharat Kalia
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.pptTareq Hasan
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILEDipta Saha
 
OOP in C++
OOP in C++OOP in C++
OOP in C++ppd1961
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cppNilesh Dalvi
 
Operator overloading
Operator overloadingOperator overloading
Operator overloadingBurhan Ahmed
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingManoj Tyagi
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++Nilesh Dalvi
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptxSKUP1
 
Lecture 2 history_of_c
Lecture 2 history_of_cLecture 2 history_of_c
Lecture 2 history_of_ceShikshak
 

What's hot (20)

Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
C++ ppt
C++ pptC++ ppt
C++ ppt
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language
 
History of c++
History of c++ History of c++
History of c++
 
Introduction to C++
Introduction to C++ Introduction to C++
Introduction to C++
 
C++ presentation
C++ presentationC++ presentation
C++ presentation
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
Constructors in C++
Constructors in C++Constructors in C++
Constructors in C++
 
OOP in C++
OOP in C++OOP in C++
OOP in C++
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cpp
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Lecture 21 - Preprocessor and Header File
Lecture 21 - Preprocessor and Header FileLecture 21 - Preprocessor and Header File
Lecture 21 - Preprocessor and Header File
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
 
Lecture 2 history_of_c
Lecture 2 history_of_cLecture 2 history_of_c
Lecture 2 history_of_c
 

Similar to Basics of c++

IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxIIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxrajkumar490591
 
C prog ppt
C prog pptC prog ppt
C prog pptxinoe
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centrejatin batra
 
1. introduction to computer
1. introduction to computer1. introduction to computer
1. introduction to computerShankar Gangaju
 
1. overview of c
1. overview of c1. overview of c
1. overview of camar kakde
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance levelsajjad ali khan
 
C programming presentation(final)
C programming presentation(final)C programming presentation(final)
C programming presentation(final)aaravSingh41
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptxMugilvannan11
 
C programming language Reference Note
C programming language Reference NoteC programming language Reference Note
C programming language Reference NoteChetan Thapa Magar
 
C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse studentsAbdur Rahim
 
Basic Information About C language PDF
Basic Information About C language PDFBasic Information About C language PDF
Basic Information About C language PDFSuraj Das
 

Similar to Basics of c++ (20)

IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxIIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
SRAVANByCPP
SRAVANByCPPSRAVANByCPP
SRAVANByCPP
 
C prog ppt
C prog pptC prog ppt
C prog ppt
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centre
 
Cp week _2.
Cp week _2.Cp week _2.
Cp week _2.
 
1. introduction to computer
1. introduction to computer1. introduction to computer
1. introduction to computer
 
1. overview of c
1. overview of c1. overview of c
1. overview of c
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 
C programming presentation(final)
C programming presentation(final)C programming presentation(final)
C programming presentation(final)
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
C language ppt
C language pptC language ppt
C language ppt
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Prog1-L1.pdf
Prog1-L1.pdfProg1-L1.pdf
Prog1-L1.pdf
 
C programming language Reference Note
C programming language Reference NoteC programming language Reference Note
C programming language Reference Note
 
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
Basic of C Programming | 2022 Updated | By Shamsul H. AnsariBasic of C Programming | 2022 Updated | By Shamsul H. Ansari
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
 
C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse students
 
Basic Information About C language PDF
Basic Information About C language PDFBasic Information About C language PDF
Basic Information About C language PDF
 
C programming
C programming C programming
C programming
 

More from Huba Akhtar

Double Linked List (Algorithm)
Double Linked List (Algorithm)Double Linked List (Algorithm)
Double Linked List (Algorithm)Huba Akhtar
 
Presentation Skills
Presentation SkillsPresentation Skills
Presentation SkillsHuba Akhtar
 
Composition in OOP
Composition in OOPComposition in OOP
Composition in OOPHuba Akhtar
 
Pakistan culture
Pakistan culturePakistan culture
Pakistan cultureHuba Akhtar
 
Programmable logic array
Programmable logic arrayProgrammable logic array
Programmable logic arrayHuba Akhtar
 
Project proposal
Project proposalProject proposal
Project proposalHuba Akhtar
 
Lahore Resolution..
Lahore Resolution..Lahore Resolution..
Lahore Resolution..Huba Akhtar
 
Islamic Civilization
Islamic CivilizationIslamic Civilization
Islamic CivilizationHuba Akhtar
 
Significance and importance of studying the life of prophet (autosaved)
Significance and importance of studying the life of prophet (autosaved)Significance and importance of studying the life of prophet (autosaved)
Significance and importance of studying the life of prophet (autosaved)Huba Akhtar
 
Listening-Skills Helpful Presentation
Listening-Skills Helpful PresentationListening-Skills Helpful Presentation
Listening-Skills Helpful PresentationHuba Akhtar
 

More from Huba Akhtar (11)

Double Linked List (Algorithm)
Double Linked List (Algorithm)Double Linked List (Algorithm)
Double Linked List (Algorithm)
 
Presentation Skills
Presentation SkillsPresentation Skills
Presentation Skills
 
Composition in OOP
Composition in OOPComposition in OOP
Composition in OOP
 
Pakistan culture
Pakistan culturePakistan culture
Pakistan culture
 
Programmable logic array
Programmable logic arrayProgrammable logic array
Programmable logic array
 
Project proposal
Project proposalProject proposal
Project proposal
 
Lahore Resolution..
Lahore Resolution..Lahore Resolution..
Lahore Resolution..
 
Islamic Civilization
Islamic CivilizationIslamic Civilization
Islamic Civilization
 
Significance and importance of studying the life of prophet (autosaved)
Significance and importance of studying the life of prophet (autosaved)Significance and importance of studying the life of prophet (autosaved)
Significance and importance of studying the life of prophet (autosaved)
 
Para-Language
Para-LanguagePara-Language
Para-Language
 
Listening-Skills Helpful Presentation
Listening-Skills Helpful PresentationListening-Skills Helpful Presentation
Listening-Skills Helpful Presentation
 

Recently uploaded

Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀DianaGray10
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupCatarinaPereira64715
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeCzechDreamin
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxAbida Shariff
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...Sri Ambati
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...Product School
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
 

Recently uploaded (20)

Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 

Basics of c++

  • 1. BASICS OF C++BASICS OF C++ Programming…Programming…
  • 2. What is C++? C++ (pronounced cee plus plus / si pl sˈ ː ʌ pl s/) is a general-purpose programmingʌ language. It has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation.
  • 3. When was C++ Created? Before the initial standardization in 1998, C+ + was developed by Bjarne Stroustrup at Bell Labs since 1979, as an extension of the C language as he wanted an efficient and flexible language similar to C, which also provided high-level features for program organization.
  • 4. For What Purpose C++ is used? C++ is one of the most versatile languages in the world. It is used nearly everywhere for everything… systems programming (operating systems, device drivers, database engines, embedded, Internet of Things, etc.)
  • 5. What is the C++ Program? C++ is an object oriented programming (OOP) language, developed by Bjarne Stroustrup, and is an extension of C language. It is therefore possible to code C+ + in a "C style" or "object-oriented style."
  • 6.
  • 7. Structure of C++ Program: The format of writing program in C++ is called its STRUCTURE. It consists of the following parts: •Preprocessor directive •Main() Function •Program Body
  • 8. Preprocessor Directive: Preprocessor Directive is an instruction given to the compiler before the execution of actual program. Preprocessor directive is also known as Compiler directive. The preprocessor directive start with “Hash” symbol ‘#.’
  • 9. Include preprocessor : Include preprocessor directive is used to include header files in the program. Syntax: #include <iostream.h>
  • 10. What are Header Files? Header files contain definitions of Functions and Variables, which is imported or used into any C++ program by using the pre- processor #include statement. Header file have an extension ".h" which contains C++ function declaration and macro definition.
  • 11. Syntax of Header files: The syntax of header files is as follows: #include <header_file_name> Name of header file can also be used in double quotes as follow: #include “header_file_name”
  • 12. Example: #include <iostream.h> The word “iostream” stands for input/output stream. This header file contains the definitions of built-in input and output functions and objects.
  • 13. main() Function: The main() function is the starting point of a C++ program. Each program must contain main() function. If a program does not contain main function, it can be compiled but cannot be executed.
  • 14. Syntax of main() function: The syntax of main() function is as follows: void main() { body of main function }
  • 15. Example: The following example explains the basic structure of C++ program: #include<iostream.h> Preprocessor void main() Main function { cout<<“Hello world”; Body Statement }
  • 16. What is Data Type in C++? A Datatype actually describes you data like what form of data you want to create (It may be integer, character, floating point number, string etc.) In the context of C++, you can make many types of data that are mentioned above.
  • 17. Cont.. To make integer datatype, you type int and then write its name (called variable name). To create floating point datatype , you type float and then write its variable. That is actually a syntax of C++. (It may differ for other languages).
  • 18. Cont… • int- integer, it is of 2 or 4 bytes dependent on machine. • char- character type (used to store characters and strings), one byte. • float- used to store floating point numbers, 4 bytes. • double- used to store high precision floating point numbers, 8 bytes.
  • 19. Variables: A Variable is a named memory location or memory cell. It is used to store program`s input data. The value of variable may change during the execution of program. However, the name of variable cannot be changed.
  • 20. How variables created? The variables are created in RAM. RAM is a temporary memory. That is why the data stored in variables is also temporary. The data stored in the variable is automatically removed when program ends.
  • 21. Variable Declaration: The process of specifying the variable name and its type is called “Variable Declaration”. Syntax: data_type variable_name; Example: int marks; float average;
  • 22. Variable Initialization: The process of assigning a value to a variable at the time of declaration is known as “Variable initialization”. The equal sign ‘=‘ is used to initialize a variable. Variable name is given on left side and value is given on the right side of equal sign.
  • 23. Syntax: The syntax of initializing a variable is as follows: data_type variable_name =value; Example: int n =100; float a=50.73;
  • 24. What are Operators? An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C++ is rich in built-in operators and provides the variety of operators: Arithmetic Operators. Relational Operators.
  • 25. Cont… The operators can be categorized as follow: Unary Operator: A type of operator that works with one operand is known as unary operator. Example: -,++,--, -a, N++, --x
  • 26. Cont… Binary Operator: A type of operator that works with two operands is known as Binary Operator. Example: +,-,*,/,% a + b; x/y;
  • 27. What are Arithmetic Operator? C++ uses operators to do arithmetic. It provides operators for five basic arithmetic calculations: addition, subtraction, multiplication, division, and taking the modulus. Each of these operators uses two values (called operands) to calculate a final answer
  • 28. Example.. Suppose we have 2 variables A & B where A=10 & B=5. Arithmetic operation can be used on A & B as follows: Operations Result A + B 15 A - B 5 A * B 50 A / B 2 A % B 0
  • 29. What is Relational operator? • In computer science, a relational operator is a programming language construct or operator that tests or defines some kind of relation between two entities. These include numerical equality (e.g., 5 = 5) and inequalities (e.g., 4 ≥ 3).
  • 30. Assignment Statement: A statement that assigns a value to a variable is known as “Assignment Statement”. Syntax: Variable = expression; “=” is the assignment operator. Example: A=100; C=A+B;
  • 31. Compound Assignment Statement: An assignment statement that assigns a value to many variables is known as “Compound Assignment” statement. Example: A=B=10; x = y= z= 100;
  • 32. Compound Assignment Operator: C++ language provides Compound Assignment operator that combines assignment operator with arithmetic operators. Syntax: Variable op=expression; Example: N+=10; is equivalent to N=N+10;
  • 33. Increment Operator: The increment operator is used to increase the value of a variable by 1. It is denoted by the symbol “++”. Increment operator can be used as follows: •Prefix form •Postfix form
  • 34. Prefix & Postfix Form: In Prefix form, the increment operator is written before the variable as follows: ++y; In Postfix form, the increment operator is written after the variable as follows: y++;
  • 35. Decrement Operator: The Decrement operator is used to decrement the value of a variable by 1. It is denoted by the symbol “—”. Decrement operator can be used in two forms: •Prefix form •Postfix form
  • 36. Prefix & Postfix Form: In prefix form, decrement operator is written before the variable as follows: --y; In postfix form, decrement operator is written after the variable as follows: y--;