SlideShare a Scribd company logo
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 Professionals
PVS-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 Centre
jatin 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 branch
SAKSHIGAWADE2
 
(2) cpp imperative programming
(2) cpp imperative programming(2) cpp imperative programming
(2) cpp imperative programming
Nico Ludwig
 
C++ lecture 01
C++   lecture 01C++   lecture 01
C++ lecture 01
HNDE Labuduwa Galle
 
C Tokens
C TokensC Tokens
C Tokens
Ripon Hossain
 
Chaptr 1
Chaptr 1Chaptr 1
Chaptr 1
Maha lakshmi
 
Managing console input
Managing console inputManaging console input
Managing console input
rajshreemuthiah
 
C-PROGRAM
C-PROGRAMC-PROGRAM
C-PROGRAM
shahzadebaujiti
 
C++ Tutorial
C++ TutorialC++ Tutorial
C++ Tutorial
freema48
 
# And ## operators in c
# And ## operators in c# And ## operators in c
# And ## operators in c
Dr. Prashant Vats
 
C introduction
C introductionC introduction
C introduction
MadhuriPareek
 
Basic concepts of python
Basic concepts of pythonBasic concepts of python
Basic concepts of python
deepalishinkar1
 
Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1
Rumman Ansari
 
C programming language
C programming languageC programming language
C programming language
Abin Rimal
 
C strings
C stringsC strings
C strings
Ducat
 

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.docx
PinkiVats1
 
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
sajjad ali khan
 
Basics Of C++.pptx
Basics Of C++.pptxBasics Of C++.pptx
Basics Of C++.pptx
DineshDhuri4
 
Chapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptChapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptDeepak Singh
 
Cp week _2.
Cp week _2.Cp week _2.
Cp week _2.
shahidullah57
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
Vikram Nandini
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdf
AbrehamKassa
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programming
Ngeam Soly
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
WondimuBantihun1
 
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 ver
Qrembiezs Intruder
 
C programming
C programmingC programming
C programming
PralhadKhanal1
 
Pointers
PointersPointers
Pointers
Swarup Boro
 
C program
C programC program
C program
AJAL A J
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
20EUEE018DEEPAKM
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdf
AdiseshaK
 
C programming notes
C programming notesC programming notes
C programming notes
Prof. Dr. K. Adisesha
 
CHAPTER-2.ppt
CHAPTER-2.pptCHAPTER-2.ppt
CHAPTER-2.ppt
Tekle12
 

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

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
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
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
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
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
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
Bhaskar Mitra
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
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
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 

Recently uploaded (20)

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
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...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
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...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
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
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
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...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 

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