SlideShare une entreprise Scribd logo
1  sur  35
 Getting started with C++
Prepared by:-
Ranjan Das & Akash deep baruah.
In 1980s bjarne Stroustrup decided to extend
the C language by adding some features from
his favourite language Simula 67. Simula 67
was one of the earliest object oriented
language. Bjarne Stroustrup called it “C with
classes”.
Later Rick Mascitti renamed as C++. Ever
since its birth, C++ evolved to cope with
problems encountered by users, and though
discussions.
 Character set is a set of valid characters that a language
can recognize. A character represents any letter, digit,
or any other sign.
Letters: A-Z, a-z
Digits: 0-9
Special Symbols: Space + - * / ^  ( ) [ ] { } = != < >
. ‘ “ $ , ; : % ! & ? _(underscore) # <= >= @
White Spaces: Blank spaces, Horizontal tab, Carriage
return, New line, Form feed.
Other Characters: C++ can process any of the 256 ASCII
characters as data or as literals.
The smallest individual unit in a program is
known as a Token or lexical unit.
Types of Tokens
 Keywords
 Identifiers
 Literals
 Punctuators
 Operators
 Keywords are the words that convey a special
meaning to the language compiler. These are
reserved for special purpose and must not be
used as normal identifier names.
asm continue float new signed try
auto default for operator sizeof typedef
break delete friend private static union
case do goto protected struct unsigned
catch double if public switch virtual
char else inline register template void
class enum int return this volatile
const extern long short throw while
 Identifiers are names of the program given by
user.
Rules to write identifiers
1. Do not start with digits.
2. No special symbols are used except
_(underscore).
3. No spaces are used.
Examples:- myfile , date9_2_7_6
 Literals (constants) are data items that never
change their value during a program run.
Types of Literals:
1. Integer constant
2. Floating constants
3. Character constant
4. String literal
 Integer constants are whole numbers without
any fractional part.
Three types of Integer constants
1. Decimal Integer constant
2. Octal Integer constant
3. Hexadecimal Integer constant
 An integer constant consisting of a sequence of
digits is taken to be decimal integer constant unless
it begins with 0 (digit zero).
Example:- 1296, 5642, 12, +69,- 23,etc.,
 A sequence of digits starting with0(digit zero) is
taken to be an octal integer.
Example:-123, 456, etc.,
 A sequence of digits preceded by 0x or 0X is taken
to be an hexadecimal integer.
Example:-4B6, A43,etc.,
 Floating constants are also called as Real
constants
Real constants are numbers having fractional
parts. These may be written in one of the two
forms called fractional form or the exponent form.
Examples:-2.0, 3.5, 8.6, etc.,
 A Character constant is one character enclosed
in single quotes, as in ‘z’.
Examples:- ‘a’, ‘b’, etc.,
a Audible sound
b back space
f Formfeed
n Newline or Linefeed
r Carriage return
t Horizontal tab
v Vertical tab
 Backslash
’ single quote
” double quote
? Question mark
on Octal number
xHn Hexadecimal number
0 Null
 Multiple character constants are treated as string
literals.
Examples:-”a” , “ade”, etc.,
 The following characters are used as
punctuators.
 [ ] ( ) { } , ; : * … = #
 Brackets [ ] opening and closing brackets
indicate single and multidimensional array
subscripts.
 Parenthesis ( ) these indicate function calls
and function parameters.
 Braces { } these indicates the start and end of a
compound statement.
 Comma , it is used as separator in a function
argument list.
 Semicolon ; it is used as statement
terminator.
 Colon : it indicates a labeled statement.
 Asterisk * it is used for pointer declaration.
 Ellipsis … Ellipsis (...) are used in the formal
argument lists of the function prototype to
indicate a variable number of argument.
 Equal to sign = It is used for variable
initialization and an assignment operator in
expressions.
 Pound sign # this sign is used for
preprocessor directive.
 Operators are tokens that trigger some
computation when applied to variables and
other objects in an expression.
Types of operators
1. Unary operators
2. Binary operators
3. Ternary operators
 Unary operators are those operators that
require one operator to operate upon.
 Examples :- +45, 5, -636,etc.,
& Addresser operator
* Indirection operator
+ Unary plus
- Unary minus
~ Bitwise complement
++ increment operator
-- decrement operator
! Logical negation
 Binary operators are those operators that
require two operands to operate upon.
 Types of Binary operators
 Arithmetic operators
+(addition) –(subtraction) *(multiplication)
/(division) %(reminder/modulus)
 Logical operators
&& (Logical AND) || (Logical OR)
 Relational operators
< (Less than)
<=(Less than or equal to)
>(Greater than)
>=(greater than or equal to)
== (equal to)
!= (not equal to)
 Why include iostream.h ?
The header file iostream.h is included in every
C++ program to implement input/output
facilities. Input/output facilities are not
defined within C++ language, but rather are
implemented in a component of C++ standard
library, iostream.h which is I/O library.
 A stream is simply a sequence of bytes.
The predefined stream objects for input, output,
error as follows:
1. Cin cin stands for console input.
2. Cout cout stands for console output.
3. Cerr cerr stands for console error.
 Comments are pieces of codes that the
compiler discards or ignores or simply does
not execute.
 Types of comments:
1. Single line comments
2. Multiline or block comments
 These comments begins with // are single line
comments. The compiler simply ignores
everything following // in that same line
 Example:-
#include<iostream.h>
Void main() // the program about addition.
 The block comments, mark the beginning of
comment with /* and end with */. That means,
everything that falls between/* and*/ is
considered as comment.
Example:-
#include<iostream.h>
Void main() /*the program is about addition*/
 Output operator “ << “
 The output operator (“<<“), also called
stream insertion operator is used to direct a value
top standard output.
 Input operator “ >> ”
 The input operator(“>>“), also known as
stream extraction operator is used to read a value
from standard input.
Variable
 A variable refers to a storage area whose
contents can vary during processing.
Cascading of I/O operators
 The multiple use of input or output
operators(“>>”or”<<“) in one statement is
called cascading of I/O operators.
 A part of the compiler’s job is to analyze the
program code for ‘correctness’. If the meaning
of the program is correct, then a compiler can
not detect errors.
Types of errors:
1. Syntax Errors
2. Semantic Errors
3. Type Errors
4. Run-time Errors
5. Logical Errors
 Syntax Errors are occurred when rules of the
program is misused i.e., when grammatical rule
of C++ is violated.
Ex:- int a, b (semicolon missing)
 Semantic Errors are occur when statements not
meaningful.
Ex:- x*y=z;
 Type Errors are occurred when the data types
are misused.
 Ex:-int a; a=123.56;
 Run-time Errors are occurred at the time of
execution.
 Logical Errors are occurred when the logic of
program is not proper.
Ex:- ctr=1;
While (ctr>10)
{
cout<<n*ctr;
ctr=ctr+1;
}
Getting started with c++.pptx

Contenu connexe

Tendances

Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data typesManisha Keim
 
Strings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiStrings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiSowmya Jyothi
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c languageRai University
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C ProgrammingQazi Shahzad Ali
 
C++
C++C++
C++k v
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introductionnikshaikh786
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C ProgrammingKamal Acharya
 
Module 3-Functions
Module 3-FunctionsModule 3-Functions
Module 3-Functionsnikshaikh786
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++Kuntal Bhowmick
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programmingChitrank Dixit
 

Tendances (20)

LISP: Input And Output
LISP: Input And OutputLISP: Input And Output
LISP: Input And Output
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data types
 
FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
 
Data type in c
Data type in cData type in c
Data type in c
 
Strings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiStrings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothi
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
C++
C++C++
C++
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
 
Unit 2. Elements of C
Unit 2. Elements of CUnit 2. Elements of C
Unit 2. Elements of C
 
Assignment5
Assignment5Assignment5
Assignment5
 
Assignment2
Assignment2Assignment2
Assignment2
 
C Tokens
C TokensC Tokens
C Tokens
 
C Token’s
C Token’sC Token’s
C Token’s
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 
Module 3-Functions
Module 3-FunctionsModule 3-Functions
Module 3-Functions
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 

Similaire à Getting started with c++.pptx

C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxLikhil181
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniquesvalarpink
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxMamataAnilgod
 
2nd PUC Computer science chapter 5 review of c++
2nd PUC Computer science chapter 5   review of c++2nd PUC Computer science chapter 5   review of c++
2nd PUC Computer science chapter 5 review of c++Aahwini Esware gowda
 
B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2Tekendra Nath Yogi
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data TypesTareq Hasan
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptxmadhurij54
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingEric Chou
 
C language
C languageC language
C languageSMS2007
 
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docxINPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docxjaggernaoma
 

Similaire à Getting started with c++.pptx (20)

Ch02
Ch02Ch02
Ch02
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
Getting started with C++
Getting started with C++Getting started with C++
Getting started with C++
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptx
 
2nd PUC Computer science chapter 5 review of c++
2nd PUC Computer science chapter 5   review of c++2nd PUC Computer science chapter 5   review of c++
2nd PUC Computer science chapter 5 review of c++
 
Token and operators
Token and operatorsToken and operators
Token and operators
 
C++ lecture 01
C++   lecture 01C++   lecture 01
C++ lecture 01
 
C-PROGRAM
C-PROGRAMC-PROGRAM
C-PROGRAM
 
1 Revision Tour
1 Revision Tour1 Revision Tour
1 Revision Tour
 
B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
 
C programming language
C programming languageC programming language
C programming language
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary Programming
 
C introduction
C introductionC introduction
C introduction
 
C language
C languageC language
C language
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docxINPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
 
C language
C languageC language
C language
 

Dernier

Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 

Dernier (20)

Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

Getting started with c++.pptx

  • 1.  Getting started with C++ Prepared by:- Ranjan Das & Akash deep baruah.
  • 2. In 1980s bjarne Stroustrup decided to extend the C language by adding some features from his favourite language Simula 67. Simula 67 was one of the earliest object oriented language. Bjarne Stroustrup called it “C with classes”. Later Rick Mascitti renamed as C++. Ever since its birth, C++ evolved to cope with problems encountered by users, and though discussions.
  • 3.  Character set is a set of valid characters that a language can recognize. A character represents any letter, digit, or any other sign. Letters: A-Z, a-z Digits: 0-9 Special Symbols: Space + - * / ^ ( ) [ ] { } = != < > . ‘ “ $ , ; : % ! & ? _(underscore) # <= >= @ White Spaces: Blank spaces, Horizontal tab, Carriage return, New line, Form feed. Other Characters: C++ can process any of the 256 ASCII characters as data or as literals.
  • 4. The smallest individual unit in a program is known as a Token or lexical unit. Types of Tokens  Keywords  Identifiers  Literals  Punctuators  Operators
  • 5.  Keywords are the words that convey a special meaning to the language compiler. These are reserved for special purpose and must not be used as normal identifier names.
  • 6. asm continue float new signed try auto default for operator sizeof typedef break delete friend private static union case do goto protected struct unsigned catch double if public switch virtual char else inline register template void class enum int return this volatile const extern long short throw while
  • 7.  Identifiers are names of the program given by user. Rules to write identifiers 1. Do not start with digits. 2. No special symbols are used except _(underscore). 3. No spaces are used. Examples:- myfile , date9_2_7_6
  • 8.  Literals (constants) are data items that never change their value during a program run. Types of Literals: 1. Integer constant 2. Floating constants 3. Character constant 4. String literal
  • 9.  Integer constants are whole numbers without any fractional part. Three types of Integer constants 1. Decimal Integer constant 2. Octal Integer constant 3. Hexadecimal Integer constant
  • 10.  An integer constant consisting of a sequence of digits is taken to be decimal integer constant unless it begins with 0 (digit zero). Example:- 1296, 5642, 12, +69,- 23,etc.,
  • 11.  A sequence of digits starting with0(digit zero) is taken to be an octal integer. Example:-123, 456, etc.,
  • 12.  A sequence of digits preceded by 0x or 0X is taken to be an hexadecimal integer. Example:-4B6, A43,etc.,
  • 13.  Floating constants are also called as Real constants Real constants are numbers having fractional parts. These may be written in one of the two forms called fractional form or the exponent form. Examples:-2.0, 3.5, 8.6, etc.,
  • 14.  A Character constant is one character enclosed in single quotes, as in ‘z’. Examples:- ‘a’, ‘b’, etc.,
  • 15. a Audible sound b back space f Formfeed n Newline or Linefeed r Carriage return t Horizontal tab v Vertical tab Backslash ’ single quote ” double quote ? Question mark on Octal number xHn Hexadecimal number 0 Null
  • 16.  Multiple character constants are treated as string literals. Examples:-”a” , “ade”, etc.,
  • 17.  The following characters are used as punctuators.  [ ] ( ) { } , ; : * … = #  Brackets [ ] opening and closing brackets indicate single and multidimensional array subscripts.  Parenthesis ( ) these indicate function calls and function parameters.
  • 18.  Braces { } these indicates the start and end of a compound statement.  Comma , it is used as separator in a function argument list.  Semicolon ; it is used as statement terminator.  Colon : it indicates a labeled statement.  Asterisk * it is used for pointer declaration.
  • 19.  Ellipsis … Ellipsis (...) are used in the formal argument lists of the function prototype to indicate a variable number of argument.  Equal to sign = It is used for variable initialization and an assignment operator in expressions.  Pound sign # this sign is used for preprocessor directive.
  • 20.  Operators are tokens that trigger some computation when applied to variables and other objects in an expression. Types of operators 1. Unary operators 2. Binary operators 3. Ternary operators
  • 21.  Unary operators are those operators that require one operator to operate upon.  Examples :- +45, 5, -636,etc.,
  • 22. & Addresser operator * Indirection operator + Unary plus - Unary minus ~ Bitwise complement ++ increment operator -- decrement operator ! Logical negation
  • 23.  Binary operators are those operators that require two operands to operate upon.  Types of Binary operators  Arithmetic operators +(addition) –(subtraction) *(multiplication) /(division) %(reminder/modulus)  Logical operators && (Logical AND) || (Logical OR)
  • 24.  Relational operators < (Less than) <=(Less than or equal to) >(Greater than) >=(greater than or equal to) == (equal to) != (not equal to)
  • 25.  Why include iostream.h ? The header file iostream.h is included in every C++ program to implement input/output facilities. Input/output facilities are not defined within C++ language, but rather are implemented in a component of C++ standard library, iostream.h which is I/O library.
  • 26.  A stream is simply a sequence of bytes. The predefined stream objects for input, output, error as follows: 1. Cin cin stands for console input. 2. Cout cout stands for console output. 3. Cerr cerr stands for console error.
  • 27.  Comments are pieces of codes that the compiler discards or ignores or simply does not execute.  Types of comments: 1. Single line comments 2. Multiline or block comments
  • 28.  These comments begins with // are single line comments. The compiler simply ignores everything following // in that same line  Example:- #include<iostream.h> Void main() // the program about addition.
  • 29.  The block comments, mark the beginning of comment with /* and end with */. That means, everything that falls between/* and*/ is considered as comment. Example:- #include<iostream.h> Void main() /*the program is about addition*/
  • 30.  Output operator “ << “  The output operator (“<<“), also called stream insertion operator is used to direct a value top standard output.  Input operator “ >> ”  The input operator(“>>“), also known as stream extraction operator is used to read a value from standard input.
  • 31. Variable  A variable refers to a storage area whose contents can vary during processing. Cascading of I/O operators  The multiple use of input or output operators(“>>”or”<<“) in one statement is called cascading of I/O operators.
  • 32.  A part of the compiler’s job is to analyze the program code for ‘correctness’. If the meaning of the program is correct, then a compiler can not detect errors. Types of errors: 1. Syntax Errors 2. Semantic Errors 3. Type Errors 4. Run-time Errors 5. Logical Errors
  • 33.  Syntax Errors are occurred when rules of the program is misused i.e., when grammatical rule of C++ is violated. Ex:- int a, b (semicolon missing)  Semantic Errors are occur when statements not meaningful. Ex:- x*y=z;  Type Errors are occurred when the data types are misused.  Ex:-int a; a=123.56;
  • 34.  Run-time Errors are occurred at the time of execution.  Logical Errors are occurred when the logic of program is not proper. Ex:- ctr=1; While (ctr>10) { cout<<n*ctr; ctr=ctr+1; }