SlideShare a Scribd company logo
Information Technology
III
Introduction to Programming with C++
History of C and C++
 History of C++
 Extension of C
 Early 1980s: Bjarne Stroustrup (Bell Laboratories)
 Provides capabilities for object-oriented programming
Objects: reusable software components
Model items in real world
Object-oriented programs
Easy to understand, correct and modify
 Hybrid language
C-like style
Object-oriented style
Both
2
Basics of a Typical C++ Environment
 C++ systems
 Program-development environment
 Language
 C++ Standard Library
3
Basics of a Typical C++ Environment4
Phases of C++ Programs:
1. Edit
2. Preprocess
3. Compile
4. Link
5. Load
6. Execute
Loader
Primary
Memory
Program is created in
the editor and stored
on disk.
Preprocessor program
processes the code.
Loader puts program
in memory.
CPU takes each
instruction and
executes it, possibly
storing new data
values as the program
executes.
Compiler
Compiler creates
object code and stores
it on disk.
Linker links the object
code with the libraries,
creates a.out and
stores it on disk
Editor
Preprocessor
Linker
CPU
Primary
Memory
.
.
.
.
.
.
.
.
.
.
.
.
Disk
Disk
Disk
Disk
Disk
Hello World
This is a comment line - the line
is a brief description of program
does.
directives for the preprocessor.
They are not executable code
lines but indications for the
compiler.
<iostream.h> tells the compiler's
preprocessor to include the iostream
standard header file.
cout is the standard
output stream
The return instruction causes the main()
function finish and return the code terminating
the program without any errors during its
execution
This line corresponds to the beginning
of the main function declaration. The
main function is the point C++
programs begin their execution. It is
first to be executed when a program
starts.
Basics of a Typical C++ Environment
 Input/output
 cin
Standard input stream
Normally keyboard
 cout
Standard output stream
Normally computer screen
 cerr
Standard error stream
Display error messages
6
Comments
 It is of 2 types:-
 Single line comments //
 example of single line comment
//this is the very simple example of single line comments
 Multi line comments
/*
This is the example of
multi line comment
*/
A Simple Program: Printing a Line of
Text
8
Escape Sequence Description
n Newline. Position the screen cursor to the
beginning of the next line.
t Horizontal tab. Move the screen cursor to the next
tab stop.
r Carriage return. Position the screen cursor to the
beginning of the current line; do not advance to the
next line.
a Alert. Sound the system bell.
 Backslash. Used to print a backslash character.
" Double quote. Used to print a double quote
character.
Variables
 Variable names
Valid identifier
Series of characters (letters, digits, underscores)
Cannot begin with digit
Case sensitive
length of an identifier is not limited, (but some compilers
only the 32 first characters rest ignore)
Neither spaces nor marked letters can be part of an
identifier
can also begin with an underline character ( _ )
your own identifiers cannot match any key word of the C++
language
9
Variables
 Location in memory where value can be stored
 Common data types
int - integer numbers
char - characters
double - double precision floating point numbers
Float - floating point numbers
Bool - Boolean value (true or false)
10
Signed and Unsigned Integer Types
 For integer data types, there are three sizes:
 Int
 long - larger size of integer,
 short, which are declared as long int and short int.
 The keywords long and short are called sub-type qualifiers.
 The requirement is that short and int must be at least 16 bits, long must be at
least 32 bits,
 short is no longer than int, which is no longer than long.
 Typically, short is 16 bits, long is 32 bits, and int is either 16 or 32 bits.
 all integer data types are signed data types,
 i.e. they have values which can be positive or negative
Declaration of variables
 Declare variables with name and data type before use
int a;
float mynumber;
int MyAccountBalance;
int integer1;
int integer2;
int sum;
int integer1, integer2, sum;
Example
 A program to add two numbers;
#include<iostream>
using namespace std;
int main() {
int a, b; // variable declaration
a = 10;
b= 20;
int addition = a + b;
cout << “answer is:” << addition << endl;
return 0;
}
Scope of variables
Global variables can
be referred to
anywhere in the
code, within any
function, whenever it
is after its declaration.
The scope of the local
variables is limited
to the code level in
which they are
declared.
Constants: Literals
 A constant is any expression that has a fixed value.
 It can be Integer Numbers, Floating-Point Numbers, Characters and
Strings
 Examples
 75 // decimal
 0113 // octal
 0x4b // hexadecimal
 6.02e23 // 6.02 x 10 23
 1.6e-19 // 1.6 x 10 -19
 3.0 // 3.0
 #define PI 3.14159265
 #define NEWLINE 'n'
circle = 2 * PI * r;
cout << NEWLINE;
Defined constants (#define)
 You can define your own names for constants simply by using the
#define preprocessor directive.
 #define identifier value
 Example
 #define PI 3.14159265
 #define NEWLINE 'n'
 #define WIDTH 100
Operators
 Input stream object
 >> (stream extraction operator)
Used with std::cin
Waits for user to input value, then press Enter (Return) key
Stores value in variable to right of operator
Converts value to variable data type
 = (assignment operator)
 Assigns value to variable
 Binary operator (two operands)
 Example:
sum = variable1 + variable2;
17
Arithmetic operators
 The five arithmetical operations
+ addition
- subtraction
* multiplication
/ division
% module
Example
int a, b;
a = 10;
b = 4;
a = b;
b = 7;
a = 2 + (b = 5);
a = b = c = 5;
a -= 5;
a /= b;
a++;
a+=1;
a=a+1;
B=3;
A=++B;
A=B++;
Relational operators
 == Equal
 != Different
 > Greater than
 < Less than
 >= Greater or equal than
 <= Less or equal than
 (7 == 5)
 (5 > 4)
 (3 != 2)
 (6 >= 6)
 Suppose that a=2, b=3and
c=6,
 (a == 5)
 (a*b >= c)
 (b+4 > a*c)
 ((b=2) == a)
Logic operators ( !, &&, || )
 For example:
 ( (5 == 5) && (3 > 6) )
 ( (5 == 5) || (3 > 6))
 Conditional operator ( ? )
 condition ? result1 : result2
 if condition is true the expression will return result1, if not it
will return result2.
 7==5 ? 4 : 3
 7==5+2 ? 4 : 3
 5>3 ? a : b
Precedence of Operators
 Rules of operator precedence
 Operators in parentheses evaluated first
 Nested/embedded parentheses
 Operators in innermost pair first
 Multiplication, division, modulus applied next
 Operators applied from left to right
 Addition, subtraction applied last
 Operators applied from left to right
22
Operator(s) Operation(s) Order of evaluation (precedence)
() Parentheses Evaluated first. If the parentheses are nested, the
expression in the innermost pair is evaluated first. If
there are several pairs of parentheses “on the same level”
(i.e., not nested), they are evaluated left to right.
*, /, or % Multiplication Division
Modulus
Evaluated second. If there are several, they re
evaluated left to right.
+ or - Addition
Subtraction
Evaluated last. If there are several, they are
evaluated left to right.
Types of Errors
 Syntax errors
A syntax error occurs when the programmer fails to obey one of the grammar
rules of the language.
 Runtime errors
A runtime error occurs whenever the program instructs the computer to do
something that it is either incapable or unwilling to do.
 Logic errors
Logic errors are usually the most difficult kind of errors to find and fix, because
there frequently is no obvious indication of the error.
Usually the program runs successfully. It simply doesn't behave as it should.
it doesn't produce the correct answers.
Syntax errors
Syntax Error: undeclared identifer “cout”
Syntax errors
 result = (firstVal - secondVal / factor;
Syntax Error: ’)’ expected
 cout << “Execution Terminated << endl;
Syntax Error: illegal string constant
 double x = 2.0, y = 3.1415, product;
x * y = product;
Syntax Error: not an l-value
Logical errors
 int a, b;
int sum = a + b;
cout << "Enter two numbers to add: ";
cin >> a; cin >> b;
cout << "The sum is: " << sum;
 char done = 'Y';
while (done = 'Y') {
//... cout << "Continue? (Y/N)";
cin >> done;
}

More Related Content

What's hot (20)

PPTX
Structure of c_program_to_input_output
Anil Dutt
 
PPT
Introduction to Basic C programming 01
Wingston
 
PDF
Introduction to c language
RavindraSalunke3
 
ODP
OpenGurukul : Language : C Programming
Open Gurukul
 
PDF
Python Programming
Saravanan T.M
 
PPT
Basic of c language
sunilchute1
 
PPTX
Fundamentals of c programming
Chitrank Dixit
 
PDF
Learning c - An extensive guide to learn the C Language
Abhishek Dwivedi
 
PPT
Unit 4 Foc
JAYA
 
PPT
C material
tarique472
 
PPSX
Complete C programming Language Course
Vivek Singh Chandel
 
PDF
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
SowmyaJyothi3
 
DOC
1. introduction to computer
Shankar Gangaju
 
PDF
C programming language
Mahmoud Eladawi
 
PPTX
Programming in C Basics
Bharat Kalia
 
PPTX
Unit ii
sathisaran
 
PPTX
C Programming basics
Jitin Pillai
 
PPS
Learn C
kantila
 
ODP
CProgrammingTutorial
Muthuselvam RS
 
PPTX
C tokens
Manu1325
 
Structure of c_program_to_input_output
Anil Dutt
 
Introduction to Basic C programming 01
Wingston
 
Introduction to c language
RavindraSalunke3
 
OpenGurukul : Language : C Programming
Open Gurukul
 
Python Programming
Saravanan T.M
 
Basic of c language
sunilchute1
 
Fundamentals of c programming
Chitrank Dixit
 
Learning c - An extensive guide to learn the C Language
Abhishek Dwivedi
 
Unit 4 Foc
JAYA
 
C material
tarique472
 
Complete C programming Language Course
Vivek Singh Chandel
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
SowmyaJyothi3
 
1. introduction to computer
Shankar Gangaju
 
C programming language
Mahmoud Eladawi
 
Programming in C Basics
Bharat Kalia
 
Unit ii
sathisaran
 
C Programming basics
Jitin Pillai
 
Learn C
kantila
 
CProgrammingTutorial
Muthuselvam RS
 
C tokens
Manu1325
 

Similar to C++ lecture 01 (20)

PDF
Lecture1
Amisha Dalal
 
PPTX
Lecture 1 Introduction C++
Ajay Khatri
 
PPT
Lecture#2 Computer languages computer system and Programming EC-105
NUST Stuff
 
PPT
Pengaturcaraan asas
Unit Kediaman Luar Kampus
 
PPTX
#Code2 create c++ for beginners
GDGKuwaitGoogleDevel
 
PPTX
lec 2.pptx
AhsanAli64749
 
PDF
Basic Elements of C++
Jason J Pulikkottil
 
PDF
THE C++ LECTURE 2 ON DATA STRUCTURES OF C++
sanatahiratoz0to9
 
PPTX
KMK1093 CHAPTER 2.kkkpptx KMK1093 CHAPTER 2.kkkpptx
JessylyneSophia
 
PDF
4. programing 101
IEEE MIU SB
 
PPT
02a fundamental c++ types, arithmetic
Manzoor ALam
 
PPT
Chapter02-S11.ppt
GhulamHussain638563
 
PPSX
Complete C++ programming Language Course
Vivek Singh Chandel
 
PPT
Savitch ch 02
Terry Yoast
 
PPT
Operators_in_C++_advantages_applications.ppt
VGaneshKarthikeyan
 
PPT
Savitch Ch 02
Terry Yoast
 
PPT
Savitch Ch 02
Terry Yoast
 
PPTX
Chap_________________1_Introduction.pptx
Ronaldo Aditya
 
PPT
Chapter 3 Expressions and Inteactivity
GhulamHussain142878
 
Lecture1
Amisha Dalal
 
Lecture 1 Introduction C++
Ajay Khatri
 
Lecture#2 Computer languages computer system and Programming EC-105
NUST Stuff
 
Pengaturcaraan asas
Unit Kediaman Luar Kampus
 
#Code2 create c++ for beginners
GDGKuwaitGoogleDevel
 
lec 2.pptx
AhsanAli64749
 
Basic Elements of C++
Jason J Pulikkottil
 
THE C++ LECTURE 2 ON DATA STRUCTURES OF C++
sanatahiratoz0to9
 
KMK1093 CHAPTER 2.kkkpptx KMK1093 CHAPTER 2.kkkpptx
JessylyneSophia
 
4. programing 101
IEEE MIU SB
 
02a fundamental c++ types, arithmetic
Manzoor ALam
 
Chapter02-S11.ppt
GhulamHussain638563
 
Complete C++ programming Language Course
Vivek Singh Chandel
 
Savitch ch 02
Terry Yoast
 
Operators_in_C++_advantages_applications.ppt
VGaneshKarthikeyan
 
Savitch Ch 02
Terry Yoast
 
Savitch Ch 02
Terry Yoast
 
Chap_________________1_Introduction.pptx
Ronaldo Aditya
 
Chapter 3 Expressions and Inteactivity
GhulamHussain142878
 
Ad

More from HNDE Labuduwa Galle (8)

PPTX
Lecture 07 networking
HNDE Labuduwa Galle
 
PPTX
Lecture 04 networking
HNDE Labuduwa Galle
 
PPTX
Lecture 03 networking
HNDE Labuduwa Galle
 
PPTX
Lecture 02 networking
HNDE Labuduwa Galle
 
PPTX
Lecture 01 networking
HNDE Labuduwa Galle
 
PPTX
C++ lecture 04
HNDE Labuduwa Galle
 
PPTX
C++ lecture 03
HNDE Labuduwa Galle
 
PPTX
C++ lecture 02
HNDE Labuduwa Galle
 
Lecture 07 networking
HNDE Labuduwa Galle
 
Lecture 04 networking
HNDE Labuduwa Galle
 
Lecture 03 networking
HNDE Labuduwa Galle
 
Lecture 02 networking
HNDE Labuduwa Galle
 
Lecture 01 networking
HNDE Labuduwa Galle
 
C++ lecture 04
HNDE Labuduwa Galle
 
C++ lecture 03
HNDE Labuduwa Galle
 
C++ lecture 02
HNDE Labuduwa Galle
 
Ad

Recently uploaded (20)

PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PPTX
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
PDF
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PPTX
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Design Thinking basics for Engineers.pdf
CMR University
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
Thermal runway and thermal stability.pptx
godow93766
 
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 

C++ lecture 01

  • 2. History of C and C++  History of C++  Extension of C  Early 1980s: Bjarne Stroustrup (Bell Laboratories)  Provides capabilities for object-oriented programming Objects: reusable software components Model items in real world Object-oriented programs Easy to understand, correct and modify  Hybrid language C-like style Object-oriented style Both 2
  • 3. Basics of a Typical C++ Environment  C++ systems  Program-development environment  Language  C++ Standard Library 3
  • 4. Basics of a Typical C++ Environment4 Phases of C++ Programs: 1. Edit 2. Preprocess 3. Compile 4. Link 5. Load 6. Execute Loader Primary Memory Program is created in the editor and stored on disk. Preprocessor program processes the code. Loader puts program in memory. CPU takes each instruction and executes it, possibly storing new data values as the program executes. Compiler Compiler creates object code and stores it on disk. Linker links the object code with the libraries, creates a.out and stores it on disk Editor Preprocessor Linker CPU Primary Memory . . . . . . . . . . . . Disk Disk Disk Disk Disk
  • 5. Hello World This is a comment line - the line is a brief description of program does. directives for the preprocessor. They are not executable code lines but indications for the compiler. <iostream.h> tells the compiler's preprocessor to include the iostream standard header file. cout is the standard output stream The return instruction causes the main() function finish and return the code terminating the program without any errors during its execution This line corresponds to the beginning of the main function declaration. The main function is the point C++ programs begin their execution. It is first to be executed when a program starts.
  • 6. Basics of a Typical C++ Environment  Input/output  cin Standard input stream Normally keyboard  cout Standard output stream Normally computer screen  cerr Standard error stream Display error messages 6
  • 7. Comments  It is of 2 types:-  Single line comments //  example of single line comment //this is the very simple example of single line comments  Multi line comments /* This is the example of multi line comment */
  • 8. A Simple Program: Printing a Line of Text 8 Escape Sequence Description n Newline. Position the screen cursor to the beginning of the next line. t Horizontal tab. Move the screen cursor to the next tab stop. r Carriage return. Position the screen cursor to the beginning of the current line; do not advance to the next line. a Alert. Sound the system bell. Backslash. Used to print a backslash character. " Double quote. Used to print a double quote character.
  • 9. Variables  Variable names Valid identifier Series of characters (letters, digits, underscores) Cannot begin with digit Case sensitive length of an identifier is not limited, (but some compilers only the 32 first characters rest ignore) Neither spaces nor marked letters can be part of an identifier can also begin with an underline character ( _ ) your own identifiers cannot match any key word of the C++ language 9
  • 10. Variables  Location in memory where value can be stored  Common data types int - integer numbers char - characters double - double precision floating point numbers Float - floating point numbers Bool - Boolean value (true or false) 10
  • 11. Signed and Unsigned Integer Types  For integer data types, there are three sizes:  Int  long - larger size of integer,  short, which are declared as long int and short int.  The keywords long and short are called sub-type qualifiers.  The requirement is that short and int must be at least 16 bits, long must be at least 32 bits,  short is no longer than int, which is no longer than long.  Typically, short is 16 bits, long is 32 bits, and int is either 16 or 32 bits.  all integer data types are signed data types,  i.e. they have values which can be positive or negative
  • 12. Declaration of variables  Declare variables with name and data type before use int a; float mynumber; int MyAccountBalance; int integer1; int integer2; int sum; int integer1, integer2, sum;
  • 13. Example  A program to add two numbers; #include<iostream> using namespace std; int main() { int a, b; // variable declaration a = 10; b= 20; int addition = a + b; cout << “answer is:” << addition << endl; return 0; }
  • 14. Scope of variables Global variables can be referred to anywhere in the code, within any function, whenever it is after its declaration. The scope of the local variables is limited to the code level in which they are declared.
  • 15. Constants: Literals  A constant is any expression that has a fixed value.  It can be Integer Numbers, Floating-Point Numbers, Characters and Strings  Examples  75 // decimal  0113 // octal  0x4b // hexadecimal  6.02e23 // 6.02 x 10 23  1.6e-19 // 1.6 x 10 -19  3.0 // 3.0  #define PI 3.14159265  #define NEWLINE 'n' circle = 2 * PI * r; cout << NEWLINE;
  • 16. Defined constants (#define)  You can define your own names for constants simply by using the #define preprocessor directive.  #define identifier value  Example  #define PI 3.14159265  #define NEWLINE 'n'  #define WIDTH 100
  • 17. Operators  Input stream object  >> (stream extraction operator) Used with std::cin Waits for user to input value, then press Enter (Return) key Stores value in variable to right of operator Converts value to variable data type  = (assignment operator)  Assigns value to variable  Binary operator (two operands)  Example: sum = variable1 + variable2; 17
  • 18. Arithmetic operators  The five arithmetical operations + addition - subtraction * multiplication / division % module
  • 19. Example int a, b; a = 10; b = 4; a = b; b = 7; a = 2 + (b = 5); a = b = c = 5; a -= 5; a /= b; a++; a+=1; a=a+1; B=3; A=++B; A=B++;
  • 20. Relational operators  == Equal  != Different  > Greater than  < Less than  >= Greater or equal than  <= Less or equal than  (7 == 5)  (5 > 4)  (3 != 2)  (6 >= 6)  Suppose that a=2, b=3and c=6,  (a == 5)  (a*b >= c)  (b+4 > a*c)  ((b=2) == a)
  • 21. Logic operators ( !, &&, || )  For example:  ( (5 == 5) && (3 > 6) )  ( (5 == 5) || (3 > 6))  Conditional operator ( ? )  condition ? result1 : result2  if condition is true the expression will return result1, if not it will return result2.  7==5 ? 4 : 3  7==5+2 ? 4 : 3  5>3 ? a : b
  • 22. Precedence of Operators  Rules of operator precedence  Operators in parentheses evaluated first  Nested/embedded parentheses  Operators in innermost pair first  Multiplication, division, modulus applied next  Operators applied from left to right  Addition, subtraction applied last  Operators applied from left to right 22 Operator(s) Operation(s) Order of evaluation (precedence) () Parentheses Evaluated first. If the parentheses are nested, the expression in the innermost pair is evaluated first. If there are several pairs of parentheses “on the same level” (i.e., not nested), they are evaluated left to right. *, /, or % Multiplication Division Modulus Evaluated second. If there are several, they re evaluated left to right. + or - Addition Subtraction Evaluated last. If there are several, they are evaluated left to right.
  • 23. Types of Errors  Syntax errors A syntax error occurs when the programmer fails to obey one of the grammar rules of the language.  Runtime errors A runtime error occurs whenever the program instructs the computer to do something that it is either incapable or unwilling to do.  Logic errors Logic errors are usually the most difficult kind of errors to find and fix, because there frequently is no obvious indication of the error. Usually the program runs successfully. It simply doesn't behave as it should. it doesn't produce the correct answers.
  • 24. Syntax errors Syntax Error: undeclared identifer “cout”
  • 25. Syntax errors  result = (firstVal - secondVal / factor; Syntax Error: ’)’ expected  cout << “Execution Terminated << endl; Syntax Error: illegal string constant  double x = 2.0, y = 3.1415, product; x * y = product; Syntax Error: not an l-value
  • 26. Logical errors  int a, b; int sum = a + b; cout << "Enter two numbers to add: "; cin >> a; cin >> b; cout << "The sum is: " << sum;  char done = 'Y'; while (done = 'Y') { //... cout << "Continue? (Y/N)"; cin >> done; }