SlideShare a Scribd company logo
1 of 21
Object Oriented Programming: 8
Basics of C++ Programming
Prof Neeraj Bhargava
Vaibhav Khanna
Department of Computer Science
School of Engineering and Systems Sciences
Maharshi Dayanand Saraswati University Ajmer
2
The Basics of a C++ Program
• Function: collection of statements; when
executed, accomplishes something
– May be predefined or standard
• Syntax: rules that specify which statements
(instructions) are legal
• Programming language: a set of rules,
symbols, and special words
• Semantic rule: meaning of the instruction
3
Comments
• Comments are for the reader, not the compiler
• Two types:
– Single line
// This is a C++ program. It prints the sentence:
// Welcome to C++ Programming.
– Multiple line
/*
You can include comments that can
occupy several lines.
*/
4
Special Symbols
• Special symbols
+
-
*
/
.
;
?
,
<=
!=
==
>=
5
Reserved Words (Keywords)
• Reserved words, keywords, or word symbols
– Include:
• int
• float
• double
• char
• const
• void
• return
6
Identifiers
• Consist of letters, digits, and the underscore
character (_)
• Must begin with a letter or underscore
• C++ is case sensitive
– NUMBER is not the same as number
• Two predefined identifiers are cout and cin
• Unlike reserved words, predefined identifiers
may be redefined, but it is not a good idea
7
Identifiers (continued)
• The following are legal identifiers in C++:
– first
– conversion
– payRate
8
Whitespaces
• Every C++ program contains whitespaces
– Include blanks, tabs, and newline characters
• Used to separate special symbols, reserved
words, and identifiers
• Proper utilization of whitespaces is important
– Can be used to make the program readable
9
Data Types
• Data type: set of values together with a set of
operations
• C++ data types fall into three categories:
10
Simple Data Types
• Three categories of simple data
– Integral: integers (numbers without a decimal)
– Floating-point: decimal numbers
– Enumeration type: user-defined data type
11
Simple Data Types (continued)
• Integral data types are further classified into
nine categories:
12
Simple Data Types (continued)
• Different compilers may allow different ranges
of values
13
int Data Type
• Examples:
-6728
0
78
+763
• Positive integers do not need a + sign
• No commas are used within an integer
– Commas are used for separating items in a list
14
bool Data Type
• bool type
– Two values: true and false
– Manipulate logical (Boolean) expressions
• true and false are called logical values
• bool, true, and false are reserved words
15
char Data Type
• The smallest integral data type
• Used for characters: letters, digits, and special
symbols
• Each character is enclosed in single quotes
– 'A', 'a', '0', '*', '+', '$', '&'
• A blank space is a character and is written '
', with a space left between the single quotes
16
• C++ uses scientific notation to represent real
numbers (floating-point notation)
Floating-Point Data Types
17
Floating-Point Data Types (continued)
– float: represents any real number
• Range: -3.4E+38 to 3.4E+38 (four bytes)
– double: represents any real number
• Range: -1.7E+308 to 1.7E+308 (eight bytes)
– On most newer compilers, data types double
and long double are same
18
Floating-Point Data Types (continued)
• Maximum number of significant digits
(decimal places) for float values is 6 or 7
• Maximum number of significant digits for
double is 15
• Precision: maximum number of significant
digits
– Float values are called single precision
– Double values are called double precision
19
Arithmetic Operators and Operator
Precedence
• C++ arithmetic operators:
– + addition
– - subtraction
– * multiplication
– / division
– % modulus operator
• +, -, *, and / can be used with integral and
floating-point data types
• Operators can be unary or binary
20
Order of Precedence
• All operations inside of () are evaluated first
• *, /, and % are at the same level of
precedence and are evaluated next
• + and – have the same level of precedence
and are evaluated last
• When operators are on the same level
– Performed from left to right (associativity)
• 3 * 7 - 6 + 2 * 5 / 4 + 6 means
(((3 * 7) – 6) + ((2 * 5) / 4 )) + 6
Assignment
• Discuss in detail the rules related to Identifiers
in C++
• What are the data types available in C++

More Related Content

What's hot

Decimal, Binary, Octal, And Hexadecimal number systems.
Decimal, Binary, Octal, And Hexadecimal number systems.Decimal, Binary, Octal, And Hexadecimal number systems.
Decimal, Binary, Octal, And Hexadecimal number systems.AOUN ABBAS
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 
Object oriented programming 13 input stream and devices in cpp
Object oriented programming 13 input stream and devices in cppObject oriented programming 13 input stream and devices in cpp
Object oriented programming 13 input stream and devices in cppVaibhav Khanna
 
Gates and Flip flop
Gates and Flip flopGates and Flip flop
Gates and Flip flophamza munir
 
Introduction to binary number system
Introduction to binary number systemIntroduction to binary number system
Introduction to binary number systemVikas Dongre
 
Number Systems
Number SystemsNumber Systems
Number SystemsGaditek
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2MOHIT TOMAR
 
Object oriented programming 11 preprocessor directives and program structure
Object oriented programming 11 preprocessor directives and program structureObject oriented programming 11 preprocessor directives and program structure
Object oriented programming 11 preprocessor directives and program structureVaibhav Khanna
 
Numeric Data Types & Strings
Numeric Data Types & StringsNumeric Data Types & Strings
Numeric Data Types & StringsAbhinav Porwal
 
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
 
Computer Programming
Computer ProgrammingComputer Programming
Computer ProgrammingBurhan Fakhar
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in CSahithi Naraparaju
 
Numbersystem 130621192712-phpapp02
Numbersystem 130621192712-phpapp02Numbersystem 130621192712-phpapp02
Numbersystem 130621192712-phpapp02muhammadsarab
 
Computerarchitecture by csa
Computerarchitecture by csaComputerarchitecture by csa
Computerarchitecture by csabathala sudhakar
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction toolssunilchute1
 

What's hot (19)

Decimal, Binary, Octal, And Hexadecimal number systems.
Decimal, Binary, Octal, And Hexadecimal number systems.Decimal, Binary, Octal, And Hexadecimal number systems.
Decimal, Binary, Octal, And Hexadecimal number systems.
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
Object oriented programming 13 input stream and devices in cpp
Object oriented programming 13 input stream and devices in cppObject oriented programming 13 input stream and devices in cpp
Object oriented programming 13 input stream and devices in cpp
 
Gates and Flip flop
Gates and Flip flopGates and Flip flop
Gates and Flip flop
 
Introduction to binary number system
Introduction to binary number systemIntroduction to binary number system
Introduction to binary number system
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2
 
Object oriented programming 11 preprocessor directives and program structure
Object oriented programming 11 preprocessor directives and program structureObject oriented programming 11 preprocessor directives and program structure
Object oriented programming 11 preprocessor directives and program structure
 
C programming Tutorial Session 1
C programming Tutorial Session 1C programming Tutorial Session 1
C programming Tutorial Session 1
 
Numeric Data Types & Strings
Numeric Data Types & StringsNumeric Data Types & Strings
Numeric Data Types & Strings
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
 
Data types
Data typesData types
Data types
 
Data types
Data typesData types
Data types
 
Cp presentation
Cp presentationCp presentation
Cp presentation
 
Numbersystem 130621192712-phpapp02
Numbersystem 130621192712-phpapp02Numbersystem 130621192712-phpapp02
Numbersystem 130621192712-phpapp02
 
Computerarchitecture by csa
Computerarchitecture by csaComputerarchitecture by csa
Computerarchitecture by csa
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction tools
 

Similar to Object oriented programming 8 basics of c++ programming

Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming LanguageAhmad Idrees
 
Chap_________________1_Introduction.pptx
Chap_________________1_Introduction.pptxChap_________________1_Introduction.pptx
Chap_________________1_Introduction.pptxRonaldo Aditya
 
9781285852744 ppt ch02
9781285852744 ppt ch029781285852744 ppt ch02
9781285852744 ppt ch02Terry Yoast
 
Basic elements of java
Basic elements of java Basic elements of java
Basic elements of java Ahmad Idrees
 
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.pptFatimaZafar68
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variablesTony Apreku
 
5 conceptos progamacion2-tema4
5 conceptos progamacion2-tema45 conceptos progamacion2-tema4
5 conceptos progamacion2-tema4Elba Sepúlveda
 
INTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageINTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageGOKULKANNANMMECLECTC
 
C programming language
C programming languageC programming language
C programming languageAbin Rimal
 
1.4 Work with data types and variables, numeric data, string data.pptx
1.4 Work with data types and variables, numeric data, string data.pptx1.4 Work with data types and variables, numeric data, string data.pptx
1.4 Work with data types and variables, numeric data, string data.pptxVGaneshKarthikeyan
 
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
 
20BCT23 – PYTHON PROGRAMMING.pptx
20BCT23 – PYTHON PROGRAMMING.pptx20BCT23 – PYTHON PROGRAMMING.pptx
20BCT23 – PYTHON PROGRAMMING.pptxgokilabrindha
 
C cpluplus 2
C cpluplus 2C cpluplus 2
C cpluplus 2sanya6900
 
9781285852744 ppt ch08
9781285852744 ppt ch089781285852744 ppt ch08
9781285852744 ppt ch08Terry Yoast
 

Similar to Object oriented programming 8 basics of c++ programming (20)

Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
C++ ch2
C++ ch2C++ ch2
C++ ch2
 
Chap_________________1_Introduction.pptx
Chap_________________1_Introduction.pptxChap_________________1_Introduction.pptx
Chap_________________1_Introduction.pptx
 
C++.ppt
C++.pptC++.ppt
C++.ppt
 
9781285852744 ppt ch02
9781285852744 ppt ch029781285852744 ppt ch02
9781285852744 ppt ch02
 
Basic elements of java
Basic elements of java Basic elements of java
Basic elements of java
 
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.ppt
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
 
5 conceptos progamacion2-tema4
5 conceptos progamacion2-tema45 conceptos progamacion2-tema4
5 conceptos progamacion2-tema4
 
INTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageINTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c language
 
Data structure Unit-I Part A
Data structure Unit-I Part AData structure Unit-I Part A
Data structure Unit-I Part A
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
C programming language
C programming languageC programming language
C programming language
 
1.4 Work with data types and variables, numeric data, string data.pptx
1.4 Work with data types and variables, numeric data, string data.pptx1.4 Work with data types and variables, numeric data, string data.pptx
1.4 Work with data types and variables, numeric data, string data.pptx
 
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
 
Basic Elements of C++
Basic Elements of C++Basic Elements of C++
Basic Elements of C++
 
20BCT23 – PYTHON PROGRAMMING.pptx
20BCT23 – PYTHON PROGRAMMING.pptx20BCT23 – PYTHON PROGRAMMING.pptx
20BCT23 – PYTHON PROGRAMMING.pptx
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
 
C cpluplus 2
C cpluplus 2C cpluplus 2
C cpluplus 2
 
9781285852744 ppt ch08
9781285852744 ppt ch089781285852744 ppt ch08
9781285852744 ppt ch08
 

More from Vaibhav Khanna

Information and network security 47 authentication applications
Information and network security 47 authentication applicationsInformation and network security 47 authentication applications
Information and network security 47 authentication applicationsVaibhav Khanna
 
Information and network security 46 digital signature algorithm
Information and network security 46 digital signature algorithmInformation and network security 46 digital signature algorithm
Information and network security 46 digital signature algorithmVaibhav Khanna
 
Information and network security 45 digital signature standard
Information and network security 45 digital signature standardInformation and network security 45 digital signature standard
Information and network security 45 digital signature standardVaibhav Khanna
 
Information and network security 44 direct digital signatures
Information and network security 44 direct digital signaturesInformation and network security 44 direct digital signatures
Information and network security 44 direct digital signaturesVaibhav Khanna
 
Information and network security 43 digital signatures
Information and network security 43 digital signaturesInformation and network security 43 digital signatures
Information and network security 43 digital signaturesVaibhav Khanna
 
Information and network security 42 security of message authentication code
Information and network security 42 security of message authentication codeInformation and network security 42 security of message authentication code
Information and network security 42 security of message authentication codeVaibhav Khanna
 
Information and network security 41 message authentication code
Information and network security 41 message authentication codeInformation and network security 41 message authentication code
Information and network security 41 message authentication codeVaibhav Khanna
 
Information and network security 40 sha3 secure hash algorithm
Information and network security 40 sha3 secure hash algorithmInformation and network security 40 sha3 secure hash algorithm
Information and network security 40 sha3 secure hash algorithmVaibhav Khanna
 
Information and network security 39 secure hash algorithm
Information and network security 39 secure hash algorithmInformation and network security 39 secure hash algorithm
Information and network security 39 secure hash algorithmVaibhav Khanna
 
Information and network security 38 birthday attacks and security of hash fun...
Information and network security 38 birthday attacks and security of hash fun...Information and network security 38 birthday attacks and security of hash fun...
Information and network security 38 birthday attacks and security of hash fun...Vaibhav Khanna
 
Information and network security 37 hash functions and message authentication
Information and network security 37 hash functions and message authenticationInformation and network security 37 hash functions and message authentication
Information and network security 37 hash functions and message authenticationVaibhav Khanna
 
Information and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theoremInformation and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theoremVaibhav Khanna
 
Information and network security 34 primality
Information and network security 34 primalityInformation and network security 34 primality
Information and network security 34 primalityVaibhav Khanna
 
Information and network security 33 rsa algorithm
Information and network security 33 rsa algorithmInformation and network security 33 rsa algorithm
Information and network security 33 rsa algorithmVaibhav Khanna
 
Information and network security 32 principles of public key cryptosystems
Information and network security 32 principles of public key cryptosystemsInformation and network security 32 principles of public key cryptosystems
Information and network security 32 principles of public key cryptosystemsVaibhav Khanna
 
Information and network security 31 public key cryptography
Information and network security 31 public key cryptographyInformation and network security 31 public key cryptography
Information and network security 31 public key cryptographyVaibhav Khanna
 
Information and network security 30 random numbers
Information and network security 30 random numbersInformation and network security 30 random numbers
Information and network security 30 random numbersVaibhav Khanna
 
Information and network security 29 international data encryption algorithm
Information and network security 29 international data encryption algorithmInformation and network security 29 international data encryption algorithm
Information and network security 29 international data encryption algorithmVaibhav Khanna
 
Information and network security 28 blowfish
Information and network security 28 blowfishInformation and network security 28 blowfish
Information and network security 28 blowfishVaibhav Khanna
 
Information and network security 27 triple des
Information and network security 27 triple desInformation and network security 27 triple des
Information and network security 27 triple desVaibhav Khanna
 

More from Vaibhav Khanna (20)

Information and network security 47 authentication applications
Information and network security 47 authentication applicationsInformation and network security 47 authentication applications
Information and network security 47 authentication applications
 
Information and network security 46 digital signature algorithm
Information and network security 46 digital signature algorithmInformation and network security 46 digital signature algorithm
Information and network security 46 digital signature algorithm
 
Information and network security 45 digital signature standard
Information and network security 45 digital signature standardInformation and network security 45 digital signature standard
Information and network security 45 digital signature standard
 
Information and network security 44 direct digital signatures
Information and network security 44 direct digital signaturesInformation and network security 44 direct digital signatures
Information and network security 44 direct digital signatures
 
Information and network security 43 digital signatures
Information and network security 43 digital signaturesInformation and network security 43 digital signatures
Information and network security 43 digital signatures
 
Information and network security 42 security of message authentication code
Information and network security 42 security of message authentication codeInformation and network security 42 security of message authentication code
Information and network security 42 security of message authentication code
 
Information and network security 41 message authentication code
Information and network security 41 message authentication codeInformation and network security 41 message authentication code
Information and network security 41 message authentication code
 
Information and network security 40 sha3 secure hash algorithm
Information and network security 40 sha3 secure hash algorithmInformation and network security 40 sha3 secure hash algorithm
Information and network security 40 sha3 secure hash algorithm
 
Information and network security 39 secure hash algorithm
Information and network security 39 secure hash algorithmInformation and network security 39 secure hash algorithm
Information and network security 39 secure hash algorithm
 
Information and network security 38 birthday attacks and security of hash fun...
Information and network security 38 birthday attacks and security of hash fun...Information and network security 38 birthday attacks and security of hash fun...
Information and network security 38 birthday attacks and security of hash fun...
 
Information and network security 37 hash functions and message authentication
Information and network security 37 hash functions and message authenticationInformation and network security 37 hash functions and message authentication
Information and network security 37 hash functions and message authentication
 
Information and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theoremInformation and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theorem
 
Information and network security 34 primality
Information and network security 34 primalityInformation and network security 34 primality
Information and network security 34 primality
 
Information and network security 33 rsa algorithm
Information and network security 33 rsa algorithmInformation and network security 33 rsa algorithm
Information and network security 33 rsa algorithm
 
Information and network security 32 principles of public key cryptosystems
Information and network security 32 principles of public key cryptosystemsInformation and network security 32 principles of public key cryptosystems
Information and network security 32 principles of public key cryptosystems
 
Information and network security 31 public key cryptography
Information and network security 31 public key cryptographyInformation and network security 31 public key cryptography
Information and network security 31 public key cryptography
 
Information and network security 30 random numbers
Information and network security 30 random numbersInformation and network security 30 random numbers
Information and network security 30 random numbers
 
Information and network security 29 international data encryption algorithm
Information and network security 29 international data encryption algorithmInformation and network security 29 international data encryption algorithm
Information and network security 29 international data encryption algorithm
 
Information and network security 28 blowfish
Information and network security 28 blowfishInformation and network security 28 blowfish
Information and network security 28 blowfish
 
Information and network security 27 triple des
Information and network security 27 triple desInformation and network security 27 triple des
Information and network security 27 triple des
 

Recently uploaded

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Recently uploaded (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

Object oriented programming 8 basics of c++ programming

  • 1. Object Oriented Programming: 8 Basics of C++ Programming Prof Neeraj Bhargava Vaibhav Khanna Department of Computer Science School of Engineering and Systems Sciences Maharshi Dayanand Saraswati University Ajmer
  • 2. 2 The Basics of a C++ Program • Function: collection of statements; when executed, accomplishes something – May be predefined or standard • Syntax: rules that specify which statements (instructions) are legal • Programming language: a set of rules, symbols, and special words • Semantic rule: meaning of the instruction
  • 3. 3 Comments • Comments are for the reader, not the compiler • Two types: – Single line // This is a C++ program. It prints the sentence: // Welcome to C++ Programming. – Multiple line /* You can include comments that can occupy several lines. */
  • 4. 4 Special Symbols • Special symbols + - * / . ; ? , <= != == >=
  • 5. 5 Reserved Words (Keywords) • Reserved words, keywords, or word symbols – Include: • int • float • double • char • const • void • return
  • 6. 6 Identifiers • Consist of letters, digits, and the underscore character (_) • Must begin with a letter or underscore • C++ is case sensitive – NUMBER is not the same as number • Two predefined identifiers are cout and cin • Unlike reserved words, predefined identifiers may be redefined, but it is not a good idea
  • 7. 7 Identifiers (continued) • The following are legal identifiers in C++: – first – conversion – payRate
  • 8. 8 Whitespaces • Every C++ program contains whitespaces – Include blanks, tabs, and newline characters • Used to separate special symbols, reserved words, and identifiers • Proper utilization of whitespaces is important – Can be used to make the program readable
  • 9. 9 Data Types • Data type: set of values together with a set of operations • C++ data types fall into three categories:
  • 10. 10 Simple Data Types • Three categories of simple data – Integral: integers (numbers without a decimal) – Floating-point: decimal numbers – Enumeration type: user-defined data type
  • 11. 11 Simple Data Types (continued) • Integral data types are further classified into nine categories:
  • 12. 12 Simple Data Types (continued) • Different compilers may allow different ranges of values
  • 13. 13 int Data Type • Examples: -6728 0 78 +763 • Positive integers do not need a + sign • No commas are used within an integer – Commas are used for separating items in a list
  • 14. 14 bool Data Type • bool type – Two values: true and false – Manipulate logical (Boolean) expressions • true and false are called logical values • bool, true, and false are reserved words
  • 15. 15 char Data Type • The smallest integral data type • Used for characters: letters, digits, and special symbols • Each character is enclosed in single quotes – 'A', 'a', '0', '*', '+', '$', '&' • A blank space is a character and is written ' ', with a space left between the single quotes
  • 16. 16 • C++ uses scientific notation to represent real numbers (floating-point notation) Floating-Point Data Types
  • 17. 17 Floating-Point Data Types (continued) – float: represents any real number • Range: -3.4E+38 to 3.4E+38 (four bytes) – double: represents any real number • Range: -1.7E+308 to 1.7E+308 (eight bytes) – On most newer compilers, data types double and long double are same
  • 18. 18 Floating-Point Data Types (continued) • Maximum number of significant digits (decimal places) for float values is 6 or 7 • Maximum number of significant digits for double is 15 • Precision: maximum number of significant digits – Float values are called single precision – Double values are called double precision
  • 19. 19 Arithmetic Operators and Operator Precedence • C++ arithmetic operators: – + addition – - subtraction – * multiplication – / division – % modulus operator • +, -, *, and / can be used with integral and floating-point data types • Operators can be unary or binary
  • 20. 20 Order of Precedence • All operations inside of () are evaluated first • *, /, and % are at the same level of precedence and are evaluated next • + and – have the same level of precedence and are evaluated last • When operators are on the same level – Performed from left to right (associativity) • 3 * 7 - 6 + 2 * 5 / 4 + 6 means (((3 * 7) – 6) + ((2 * 5) / 4 )) + 6
  • 21. Assignment • Discuss in detail the rules related to Identifiers in C++ • What are the data types available in C++