SlideShare a Scribd company logo
1 of 21
1
1
Khawaja Sharif Sediqi
Basics of C++
Programming Language
Comments
Comments are explanatory statement that you
can include in the C++ code to explain what the
code is doing.
The compiler ignores everything that appears int
the comment.so none of that information shows in
the result.
A comment beginning with two slashes (//) is
called single-line comment.
The slashes tell the compiler to ignore everything
that follows.
until the end of the line
3
Comment
1. # include <iostream>
2. using namespace std;
3. //std is declaration region
4. int main ()
5. {
6. //pring “hello world”
7. cout<<“Hello Word!”;
8. return 0;
9. }
Hello Word!
4
When the following code is compiled , it will ignore the
// prints “ hello world” statement and will produce the following result.
Which choice indicate a signal-line comment
// single line comment
** single line comment
##single the comment
5
Which choice indicate a signal-line comment
// single line comment
** single line comment
##single the comment
6
Multi-Line Comments
Comment that require multiple lines begin with
/* and end with */
You can place them on the same line or insert
one or more lines between them.
/* This is a comment */
/* C++ comments can
Span multiple lines
*/
7
Create a block comment ( multiline comment) in C+
+
This is a block /multiline
Comment in C++
8
Create a block comment ( multiline comment) in C+
+
This is a block /multiline
Comment in C++
9
/*
*/
Which of the following in true
Comments are ignored by the compiler
Comments are used to confuse programmers
single line comments starts with an *
10
Which of the following in true
Comments are ignored by the compiler
Comments are used to confuse programmers
single line comments starts with an *
11
Variables
Creating a variable reserves a memory location.
Space in memory for storing values . The
compiler that you provide a data type for each
variable you declare.
C++ offer a rich assortment of built-in as well as
user defined data type.
Integer , a built-in type , represents a whole
number value. Define Integer using the keyword
int C++ requires that you specify the type and
identifier for each variable defined
12
Variables
An identifier is a name for a variable, function
class,module,or any other user-defined item.
An identifier stars with a letter ( A-Z or a-z) or an
underscore ( _ ) followed by additional
letters,underscores,and digits ( 0 – 9 )
For example
Define a variable called myVariable that can hold
integer values as follows.
Int myVariable= 10;
13
What is the data type name for integer?
Double
integer
Int
number
14
Variables
Now , Lets assign a values to the variable and
print it.
1.# include <iostream>
2. using namespace std;
3. int main () { 10
4.Int myVariable = 10 ;
5. cout<<“Hello Word!”;
6.Return 0;
7. }
// output 10 15
What is the data type name for integer?
Double
integer
Int
number
16
i The C++ programing language is Case-Sensitive , So
myVariable and myvaraible are tow deferent .
Variables
Define all variables with a name and a data type
before using them in a program. In cases in which
you have multipl3e variables of the same type.it’s
possible to define them in one declaration
,separating them with commas
Int a , b ;
//define two variable of type int.
17
Variables
A variable can be assigned a value , and can be
used to perform operations.
For Example , we can create an additional
variable called sum, and two variable together.
int a =10;
int b = 40 ;
int sum = a + b;
// Now sum equals 50.
18
i Use the + operator to add two numbers.
Variables
Let’s create a program to calculate and print the
sum of two integer.
1. # include <iostream>
2. using namespace std;
3. int main () {
4.int a =10;
5.int b = 40 ;
6.int sum = a + b;
cout << sum ;
7.Return 0;
8.// output 42
19
i
Always keep in mind that all variables must be defined with a
name and a data type before they can be used.
Which two statement are true for variable in C++?
variable do not have name
variable must be declared before their use.
Variable are pre-processor directive
Variable must have a data type
20
Which two statement are true for variable in C++?
variable do not have name
variable must be declared before their use.
Variable are pre-processor directive
Variable must have a data type
21

More Related Content

What's hot

Logical Expressions in C/C++. Mistakes Made by Professionals
Logical Expressions in C/C++. Mistakes Made by ProfessionalsLogical Expressions in C/C++. Mistakes Made by Professionals
Logical Expressions in C/C++. Mistakes Made by ProfessionalsPVS-Studio
 
C++ Programming Language Training in Ambala ! Batra Computer Centre
C++ Programming Language Training in Ambala ! Batra Computer CentreC++ Programming Language Training in Ambala ! Batra Computer Centre
C++ Programming Language Training in Ambala ! Batra Computer Centrejatin batra
 
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branchComputer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branchSAKSHIGAWADE2
 
(2) cpp imperative programming
(2) cpp imperative programming(2) cpp imperative programming
(2) cpp imperative programmingNico Ludwig
 
C++ Tutorial
C++ TutorialC++ Tutorial
C++ Tutorialfreema48
 
Basic concepts of python
Basic concepts of pythonBasic concepts of python
Basic concepts of pythondeepalishinkar1
 
Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Rumman Ansari
 
C programming language
C programming languageC programming language
C programming languageAbin Rimal
 
C strings
C stringsC strings
C stringsDucat
 

What's hot (19)

Logical Expressions in C/C++. Mistakes Made by Professionals
Logical Expressions in C/C++. Mistakes Made by ProfessionalsLogical Expressions in C/C++. Mistakes Made by Professionals
Logical Expressions in C/C++. Mistakes Made by Professionals
 
Pengaturcaraan asas
Pengaturcaraan asasPengaturcaraan asas
Pengaturcaraan asas
 
C++ Programming Language Training in Ambala ! Batra Computer Centre
C++ Programming Language Training in Ambala ! Batra Computer CentreC++ Programming Language Training in Ambala ! Batra Computer Centre
C++ Programming Language Training in Ambala ! Batra Computer Centre
 
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branchComputer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
(2) cpp imperative programming
(2) cpp imperative programming(2) cpp imperative programming
(2) cpp imperative programming
 
C++ lecture 01
C++   lecture 01C++   lecture 01
C++ lecture 01
 
C Tokens
C TokensC Tokens
C Tokens
 
Chaptr 1
Chaptr 1Chaptr 1
Chaptr 1
 
Managing console input
Managing console inputManaging console input
Managing console input
 
C-PROGRAM
C-PROGRAMC-PROGRAM
C-PROGRAM
 
C++ Tutorial
C++ TutorialC++ Tutorial
C++ Tutorial
 
# And ## operators in c
# And ## operators in c# And ## operators in c
# And ## operators in c
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
C introduction
C introductionC introduction
C introduction
 
Basic concepts of python
Basic concepts of pythonBasic concepts of python
Basic concepts of python
 
Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1
 
C programming language
C programming languageC programming language
C programming language
 
C strings
C stringsC strings
C strings
 

Similar to Beginner C++ easy slide and simple definition with questions

C++ Tutorial.docx
C++ Tutorial.docxC++ Tutorial.docx
C++ Tutorial.docxPinkiVats1
 
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
 
Basics Of C++.pptx
Basics Of C++.pptxBasics Of C++.pptx
Basics Of C++.pptxDineshDhuri4
 
Chapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptChapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptDeepak Singh
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfAbrehamKassa
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programmingNgeam Soly
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic Manzoor ALam
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.pptTareq Hasan
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verQrembiezs Intruder
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdfAdiseshaK
 
CHAPTER-2.ppt
CHAPTER-2.pptCHAPTER-2.ppt
CHAPTER-2.pptTekle12
 

Similar to Beginner C++ easy slide and simple definition with questions (20)

C++ Tutorial.docx
C++ Tutorial.docxC++ Tutorial.docx
C++ Tutorial.docx
 
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
 
Basics Of C++.pptx
Basics Of C++.pptxBasics Of C++.pptx
Basics Of C++.pptx
 
Chapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptChapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory Concept
 
Cp week _2.
Cp week _2.Cp week _2.
Cp week _2.
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdf
 
Chapter2
Chapter2Chapter2
Chapter2
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programming
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
 
C programming
C programmingC programming
C programming
 
Pointers
PointersPointers
Pointers
 
C program
C programC program
C program
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdf
 
C programming notes
C programming notesC programming notes
C programming notes
 
CHAPTER-2.ppt
CHAPTER-2.pptCHAPTER-2.ppt
CHAPTER-2.ppt
 

Recently uploaded

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Beginner C++ easy slide and simple definition with questions

  • 1. 1 1
  • 2. Khawaja Sharif Sediqi Basics of C++ Programming Language
  • 3. Comments Comments are explanatory statement that you can include in the C++ code to explain what the code is doing. The compiler ignores everything that appears int the comment.so none of that information shows in the result. A comment beginning with two slashes (//) is called single-line comment. The slashes tell the compiler to ignore everything that follows. until the end of the line 3
  • 4. Comment 1. # include <iostream> 2. using namespace std; 3. //std is declaration region 4. int main () 5. { 6. //pring “hello world” 7. cout<<“Hello Word!”; 8. return 0; 9. } Hello Word! 4 When the following code is compiled , it will ignore the // prints “ hello world” statement and will produce the following result.
  • 5. Which choice indicate a signal-line comment // single line comment ** single line comment ##single the comment 5
  • 6. Which choice indicate a signal-line comment // single line comment ** single line comment ##single the comment 6
  • 7. Multi-Line Comments Comment that require multiple lines begin with /* and end with */ You can place them on the same line or insert one or more lines between them. /* This is a comment */ /* C++ comments can Span multiple lines */ 7
  • 8. Create a block comment ( multiline comment) in C+ + This is a block /multiline Comment in C++ 8
  • 9. Create a block comment ( multiline comment) in C+ + This is a block /multiline Comment in C++ 9 /* */
  • 10. Which of the following in true Comments are ignored by the compiler Comments are used to confuse programmers single line comments starts with an * 10
  • 11. Which of the following in true Comments are ignored by the compiler Comments are used to confuse programmers single line comments starts with an * 11
  • 12. Variables Creating a variable reserves a memory location. Space in memory for storing values . The compiler that you provide a data type for each variable you declare. C++ offer a rich assortment of built-in as well as user defined data type. Integer , a built-in type , represents a whole number value. Define Integer using the keyword int C++ requires that you specify the type and identifier for each variable defined 12
  • 13. Variables An identifier is a name for a variable, function class,module,or any other user-defined item. An identifier stars with a letter ( A-Z or a-z) or an underscore ( _ ) followed by additional letters,underscores,and digits ( 0 – 9 ) For example Define a variable called myVariable that can hold integer values as follows. Int myVariable= 10; 13
  • 14. What is the data type name for integer? Double integer Int number 14
  • 15. Variables Now , Lets assign a values to the variable and print it. 1.# include <iostream> 2. using namespace std; 3. int main () { 10 4.Int myVariable = 10 ; 5. cout<<“Hello Word!”; 6.Return 0; 7. } // output 10 15
  • 16. What is the data type name for integer? Double integer Int number 16 i The C++ programing language is Case-Sensitive , So myVariable and myvaraible are tow deferent .
  • 17. Variables Define all variables with a name and a data type before using them in a program. In cases in which you have multipl3e variables of the same type.it’s possible to define them in one declaration ,separating them with commas Int a , b ; //define two variable of type int. 17
  • 18. Variables A variable can be assigned a value , and can be used to perform operations. For Example , we can create an additional variable called sum, and two variable together. int a =10; int b = 40 ; int sum = a + b; // Now sum equals 50. 18 i Use the + operator to add two numbers.
  • 19. Variables Let’s create a program to calculate and print the sum of two integer. 1. # include <iostream> 2. using namespace std; 3. int main () { 4.int a =10; 5.int b = 40 ; 6.int sum = a + b; cout << sum ; 7.Return 0; 8.// output 42 19 i Always keep in mind that all variables must be defined with a name and a data type before they can be used.
  • 20. Which two statement are true for variable in C++? variable do not have name variable must be declared before their use. Variable are pre-processor directive Variable must have a data type 20
  • 21. Which two statement are true for variable in C++? variable do not have name variable must be declared before their use. Variable are pre-processor directive Variable must have a data type 21