SlideShare a Scribd company logo
1 of 24
Data
Types
A P r e s e n t a t i o n O n C + + P r o g r a m m i n g
What Is C++
Programming
 C++ Is An Object Oriented Programming (OOP)
Language,
 Developed By Bjarne Stroustrup,
 Is An Extension Of C Language
 Possible To Code C++ In A "C Style" Or "Object-
oriented Style.“
 Can Be Coded In Either Way And Is Thus An Effective
Example Of A Hybrid Language.
 It Is Pronounced "C-plus-plus."
What Is C++
Programming
 C++ Is A General Purpose Object Oriented
Programming Language.
 It Is Considered To Be An Intermediate Level
Language,
 It Encapsulates Both High And Low Level Language
Features.
 The Language Was Called 'C With Classes’ As It Had
All Properties Of C
Data Types
A Data Type can be Classified:
 Identifying One Of Various Types Of Data,
 Such As Real, Integer Or Boolean,
 Determines The Possible Values For That Type,
 Operations Can Be Done On Values Of That Type,
 The Meaning Of The Data,
 The Way Values Of That Type Can Be Stored.
 While doing programming in any programming language, you
need to use various variables to store various information.
 Variables are nothing but reserved memory locations to store
values.
 This means that when you create a variable you reserve
some space in memory.
 You may like to store information of various data types like
character, wide character, integer, floating point, double
floating point, Boolean etc.
 Based on the data type of a variable, the operating system
allocates memory and decides what can be stored in the
reserved memory.
Types Of Data Types
USER DEFINED
DERIVED
PRIMITIVE
Primitive Data Types
 Primitive data types are predefined types of data, which
are supported by the programming language.
 For example , integer, character, and string are all
primitive data types.
 Programmers can use these data types when creating
variables in their programs.
 For example, a programmer may create a variable
called "lastname" and define it as a string data type.
 The variable will then store data as a string of
characters.
Char
 character
 C++ offers a predefined data type that is one byte in
size, which can hold exactly one character
 Such as ‘a’ or ‘A’. To declare a variable of type char, we
have
 Char ch;
 Suppose we want to store a character value ‘a’, in a
char data type ch, it is enclosed within a single quote.
 Ch = ‘a’;
 Only a single character can be stored in a variable of
type char.
Int
 integer
 On most machines the size of int type is 2 bytes.
 C++ defines this type as consisting of the values
ranging from -32768 to 32767.
 This range is for the small integer. If long integer is
needed the type long or long int can be used.
 The range of long int is too big that is from-2147483648
to 2147483647, which occupies 4 bytes in memory.
Float
 C++ defines the data type float as representing
numbers that have fractional part.
 For example,12.55 as opposed to integers which have
no fractional part.
 Floating point variables can either be small or large.
 A variable with type float occupies 4 bytes in size and
can hold numbers from 10-308 to 10—308 with about
15 digits of precision.
 There is a long double, also available, that can hold
numbers from 10--4932 to 10-4932.
Boolean
 Bool
 Unlike ‘C’, it is an additional data type for representing
a Boolean value.
 A variable associated with a bool data type may be
assigned an integer value 1 to the literal true or a
value 0 to the literal false.
Derived Data Types
 Data types that are derived from the built-in data types
are known as derived data types.
 The various derived data types provided by C++ are
arrays, junctions, references and pointers.
Array
 Series Of Elements Of The Same Type Placed In
Contiguous Memory Locations
 Can Be Individually Referenced By Adding An Index To
A Unique Identifier.
 For Example, Five Values Of Type Int Can Be Declared
As An Array Without Having To Declare 5 Different
Variables (Each With Its Own Identifier).
Pointer
 For a C++ program, the memory of a computer is like a
succession of memory cells, each one byte in size, and
each with a unique address.
 These single-byte memory cells are ordered in a way
that allows data representations larger than one byte to
occupy memory cells that have consecutive addresses.
 This way, each cell can be easily located in the memory
by means of its unique address.
 For example, the memory cell with the
address 1776 always follows immediately after the cell
with address 1775 and precedes the one with 1777, and
is exactly one thousand cells after 776 and exactly one
thousand cells before 2776.
Function
 Functions allow to structure programs in segments of
code to perform individual tasks .
 In C++, a function is a group of statements that is given
a name, and which can be called from some point of the
program.
 The most common syntax to define a function is:
type name ( parameter1, parameter2, ...) { statements
 Where:
- type is the type of the value returned by the function.
- name is the identifier by which the function can be
called.
- parameters (as many as needed): Each parameter
consists of a type followed by an identifier, with each
parameter being separated from the next by a comma
User Defined Types
These are of Three Types are -
 Enumerated
 Structure
 Union
Enumerated
 An enumerated type (also called an enumeration)
 is a data type where every possible value is defined as
a symbolic constant (called an enumerator).
 Enumerations are declared via the enum keyword.
Structure
 Structure is another user defined data type which
allows you to combine data items of different kinds.
 Structures are used to represent a record, suppose you
want to keep track of your books in a library. You might
want to track the following attributes about each book:
 Title
 Author
 Subject
 Book ID
Union
 Unions allow one portion of memory to be accessed as
different data types.
 Its Declaration and use is similar to the one of
structures, but its functionality is totally different.
Basic Program Based On float
#inc lude< ios tream.h >
#inc lude< c onio.h>
void main( )
{
Float a,b,c ,d
a= 7
b= 6
c = 9
d = a+ b+c
c out< <n;
getc h ( ) ;
}
Basic Program Based On Array
#include<iostream.h>
#include<conio.h>
void main()
{
intX[5]={2,5,8,1,6};
floatY[5]={1.2,3.1,4.2,5.1,6.1};
int i;
cout<<“ array x”;
for(i=0;i<5;i++)
{
cout<<“display of x[“<<i<<”]<<x[i];
cout<<‘array of y”;
for(i=0;i<5;i++)
cout<<“Display of array
Y[“<<i<<”]<<Y[i];
}
getch();
}
Basic Program Based On enum
#include <iostream>
using namespace std;
main()
{
enum
{
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
} day;
day = Wednesday;
if(day == saturday || day == sunday)
cout << "Day is a weekend day" << endl;
else if(day == wednesday)
cout << "Day is hump day - middle of the work week" << endl;
}
THANK YOU
S A C H I N S AT WA S K A R

More Related Content

What's hot

Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersTanishq Soni
 
Fundamental of C Programming (Data Types)
Fundamental of C Programming (Data Types)Fundamental of C Programming (Data Types)
Fundamental of C Programming (Data Types)jimmy majumder
 
Programming Fundamentals lecture 6
Programming Fundamentals lecture 6Programming Fundamentals lecture 6
Programming Fundamentals lecture 6REHAN IJAZ
 
Structure and Typedef
Structure and TypedefStructure and Typedef
Structure and TypedefAcad
 
Presentation on basics of python
Presentation on basics of pythonPresentation on basics of python
Presentation on basics of pythonNanditaDutta4
 
11 Unit 1 Chapter 03 Data Handling
11   Unit 1 Chapter 03 Data Handling11   Unit 1 Chapter 03 Data Handling
11 Unit 1 Chapter 03 Data HandlingPraveen M Jigajinni
 
Data structure Assignment Help
Data structure Assignment HelpData structure Assignment Help
Data structure Assignment HelpJosephErin
 
What is Data Types and Functions?
What is Data Types and Functions?What is Data Types and Functions?
What is Data Types and Functions?AnuragSrivastava272
 
SWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mappingSWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mappingMariano Rodriguez-Muro
 
Core C# Programming Constructs, Part 1
Core C# Programming Constructs, Part 1Core C# Programming Constructs, Part 1
Core C# Programming Constructs, Part 1Vahid Farahmandian
 

What's hot (20)

Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiers
 
Data types
Data typesData types
Data types
 
Data Handling
Data HandlingData Handling
Data Handling
 
Fundamental of C Programming (Data Types)
Fundamental of C Programming (Data Types)Fundamental of C Programming (Data Types)
Fundamental of C Programming (Data Types)
 
Typedef
TypedefTypedef
Typedef
 
Programming Fundamentals lecture 6
Programming Fundamentals lecture 6Programming Fundamentals lecture 6
Programming Fundamentals lecture 6
 
Structure and Typedef
Structure and TypedefStructure and Typedef
Structure and Typedef
 
Presentation on basics of python
Presentation on basics of pythonPresentation on basics of python
Presentation on basics of python
 
C programming unit 01
C programming unit 01C programming unit 01
C programming unit 01
 
11 Unit 1 Chapter 03 Data Handling
11   Unit 1 Chapter 03 Data Handling11   Unit 1 Chapter 03 Data Handling
11 Unit 1 Chapter 03 Data Handling
 
Data structure Assignment Help
Data structure Assignment HelpData structure Assignment Help
Data structure Assignment Help
 
Md121 streams
Md121 streamsMd121 streams
Md121 streams
 
SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2
 
Introductio to c++
Introductio to c++Introductio to c++
Introductio to c++
 
What is Data Types and Functions?
What is Data Types and Functions?What is Data Types and Functions?
What is Data Types and Functions?
 
SWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mappingSWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mapping
 
SWT Lecture Session 10 R2RML Part 1
SWT Lecture Session 10 R2RML Part 1SWT Lecture Session 10 R2RML Part 1
SWT Lecture Session 10 R2RML Part 1
 
Io Summary
Io SummaryIo Summary
Io Summary
 
Core C# Programming Constructs, Part 1
Core C# Programming Constructs, Part 1Core C# Programming Constructs, Part 1
Core C# Programming Constructs, Part 1
 
Types in .net
Types in .netTypes in .net
Types in .net
 

Similar to Data types

Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Typesk v
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++Neeru Mittal
 
variablesfinal-170820055428 data type results
variablesfinal-170820055428 data type resultsvariablesfinal-170820055428 data type results
variablesfinal-170820055428 data type resultsatifmugheesv
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data typesManisha Keim
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...Rowank2
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.pptAqeelAbbas94
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language Rowank2
 
Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptxRowank2
 
cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfYRABHI
 
data types in C programming
data types in C programmingdata types in C programming
data types in C programmingHarshita Yadav
 
C programming basic concepts of mahi.pptx
C programming basic concepts of mahi.pptxC programming basic concepts of mahi.pptx
C programming basic concepts of mahi.pptxKorbanMaheshwari
 
Basic Concepts of C Language.pptx
Basic Concepts of C Language.pptxBasic Concepts of C Language.pptx
Basic Concepts of C Language.pptxKorbanMaheshwari
 
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...ssuser5610081
 
Data Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docxData Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docxtheodorelove43763
 

Similar to Data types (20)

Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
 
variablesfinal-170820055428 data type results
variablesfinal-170820055428 data type resultsvariablesfinal-170820055428 data type results
variablesfinal-170820055428 data type results
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data types
 
Lecture 3.mte 407
Lecture 3.mte 407Lecture 3.mte 407
Lecture 3.mte 407
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
 
C tutorial
C tutorialC tutorial
C tutorial
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language
 
Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptx
 
Structured Languages
Structured LanguagesStructured Languages
Structured Languages
 
unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
 
cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdf
 
data types in C programming
data types in C programmingdata types in C programming
data types in C programming
 
Datatypes in c
Datatypes in cDatatypes in c
Datatypes in c
 
C programming basic concepts of mahi.pptx
C programming basic concepts of mahi.pptxC programming basic concepts of mahi.pptx
C programming basic concepts of mahi.pptx
 
Basic Concepts of C Language.pptx
Basic Concepts of C Language.pptxBasic Concepts of C Language.pptx
Basic Concepts of C Language.pptx
 
C#
C#C#
C#
 
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
 
Data Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docxData Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docx
 

Recently uploaded

Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
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
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
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
 

Recently uploaded (20)

Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
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
 
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
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
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
 

Data types

  • 1. Data Types A P r e s e n t a t i o n O n C + + P r o g r a m m i n g
  • 2. What Is C++ Programming  C++ Is An Object Oriented Programming (OOP) Language,  Developed By Bjarne Stroustrup,  Is An Extension Of C Language  Possible To Code C++ In A "C Style" Or "Object- oriented Style.“  Can Be Coded In Either Way And Is Thus An Effective Example Of A Hybrid Language.  It Is Pronounced "C-plus-plus."
  • 3. What Is C++ Programming  C++ Is A General Purpose Object Oriented Programming Language.  It Is Considered To Be An Intermediate Level Language,  It Encapsulates Both High And Low Level Language Features.  The Language Was Called 'C With Classes’ As It Had All Properties Of C
  • 4. Data Types A Data Type can be Classified:  Identifying One Of Various Types Of Data,  Such As Real, Integer Or Boolean,  Determines The Possible Values For That Type,  Operations Can Be Done On Values Of That Type,  The Meaning Of The Data,  The Way Values Of That Type Can Be Stored.
  • 5.  While doing programming in any programming language, you need to use various variables to store various information.  Variables are nothing but reserved memory locations to store values.  This means that when you create a variable you reserve some space in memory.  You may like to store information of various data types like character, wide character, integer, floating point, double floating point, Boolean etc.  Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory.
  • 6. Types Of Data Types USER DEFINED DERIVED PRIMITIVE
  • 7.
  • 8. Primitive Data Types  Primitive data types are predefined types of data, which are supported by the programming language.  For example , integer, character, and string are all primitive data types.  Programmers can use these data types when creating variables in their programs.  For example, a programmer may create a variable called "lastname" and define it as a string data type.  The variable will then store data as a string of characters.
  • 9. Char  character  C++ offers a predefined data type that is one byte in size, which can hold exactly one character  Such as ‘a’ or ‘A’. To declare a variable of type char, we have  Char ch;  Suppose we want to store a character value ‘a’, in a char data type ch, it is enclosed within a single quote.  Ch = ‘a’;  Only a single character can be stored in a variable of type char.
  • 10. Int  integer  On most machines the size of int type is 2 bytes.  C++ defines this type as consisting of the values ranging from -32768 to 32767.  This range is for the small integer. If long integer is needed the type long or long int can be used.  The range of long int is too big that is from-2147483648 to 2147483647, which occupies 4 bytes in memory.
  • 11. Float  C++ defines the data type float as representing numbers that have fractional part.  For example,12.55 as opposed to integers which have no fractional part.  Floating point variables can either be small or large.  A variable with type float occupies 4 bytes in size and can hold numbers from 10-308 to 10—308 with about 15 digits of precision.  There is a long double, also available, that can hold numbers from 10--4932 to 10-4932.
  • 12. Boolean  Bool  Unlike ‘C’, it is an additional data type for representing a Boolean value.  A variable associated with a bool data type may be assigned an integer value 1 to the literal true or a value 0 to the literal false.
  • 13. Derived Data Types  Data types that are derived from the built-in data types are known as derived data types.  The various derived data types provided by C++ are arrays, junctions, references and pointers.
  • 14. Array  Series Of Elements Of The Same Type Placed In Contiguous Memory Locations  Can Be Individually Referenced By Adding An Index To A Unique Identifier.  For Example, Five Values Of Type Int Can Be Declared As An Array Without Having To Declare 5 Different Variables (Each With Its Own Identifier).
  • 15. Pointer  For a C++ program, the memory of a computer is like a succession of memory cells, each one byte in size, and each with a unique address.  These single-byte memory cells are ordered in a way that allows data representations larger than one byte to occupy memory cells that have consecutive addresses.  This way, each cell can be easily located in the memory by means of its unique address.  For example, the memory cell with the address 1776 always follows immediately after the cell with address 1775 and precedes the one with 1777, and is exactly one thousand cells after 776 and exactly one thousand cells before 2776.
  • 16. Function  Functions allow to structure programs in segments of code to perform individual tasks .  In C++, a function is a group of statements that is given a name, and which can be called from some point of the program.  The most common syntax to define a function is: type name ( parameter1, parameter2, ...) { statements  Where: - type is the type of the value returned by the function. - name is the identifier by which the function can be called. - parameters (as many as needed): Each parameter consists of a type followed by an identifier, with each parameter being separated from the next by a comma
  • 17. User Defined Types These are of Three Types are -  Enumerated  Structure  Union
  • 18. Enumerated  An enumerated type (also called an enumeration)  is a data type where every possible value is defined as a symbolic constant (called an enumerator).  Enumerations are declared via the enum keyword.
  • 19. Structure  Structure is another user defined data type which allows you to combine data items of different kinds.  Structures are used to represent a record, suppose you want to keep track of your books in a library. You might want to track the following attributes about each book:  Title  Author  Subject  Book ID
  • 20. Union  Unions allow one portion of memory to be accessed as different data types.  Its Declaration and use is similar to the one of structures, but its functionality is totally different.
  • 21. Basic Program Based On float #inc lude< ios tream.h > #inc lude< c onio.h> void main( ) { Float a,b,c ,d a= 7 b= 6 c = 9 d = a+ b+c c out< <n; getc h ( ) ; }
  • 22. Basic Program Based On Array #include<iostream.h> #include<conio.h> void main() { intX[5]={2,5,8,1,6}; floatY[5]={1.2,3.1,4.2,5.1,6.1}; int i; cout<<“ array x”; for(i=0;i<5;i++) { cout<<“display of x[“<<i<<”]<<x[i]; cout<<‘array of y”; for(i=0;i<5;i++) cout<<“Display of array Y[“<<i<<”]<<Y[i]; } getch(); }
  • 23. Basic Program Based On enum #include <iostream> using namespace std; main() { enum { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday } day; day = Wednesday; if(day == saturday || day == sunday) cout << "Day is a weekend day" << endl; else if(day == wednesday) cout << "Day is hump day - middle of the work week" << endl; }
  • 24. THANK YOU S A C H I N S AT WA S K A R