SlideShare a Scribd company logo
1 of 17
C++ Language 
By:-AAKASH KAUSHIK 
#9289817971, 98919893083 
Email-theaakashkumar@gmail.com
UNIT -3 
VARIABLES & DATA 
TYPES
VARIABLES 
Variables are used to store values. 
Variables are name of storage location where 
data of particular type can be stored. 
Variables stores the latest updated value. 
We can use any valid Identifier as a variable 
name. 
AAKASH KAUSHIK 
9891983083,9289817971
DECLARATION OF VARIABLES 
Declaration syntax:- 
Datatype variablename; 
Where data type could be any valid Data type for 
ex.- int, char, float, etc. and variable name could be 
any valid identifier. 
For ex. 
int a; 
char b; 
float c; 
AAKASH KAUSHIK 
9891983083,9289817971
INTIALIZATION OF VARIABLES 
Intialization means assigning value to declared 
variable. 
For ex:- 
a=10; 
b=‘A’; 
c=3.14; 
AAKASH KAUSHIK 
9891983083,9289817971
MORE ON DECLARATION AND 
INTIALIZATION 
Declaration and initialization can take place in 
same statement also. 
For ex.:- 
int a=10; 
We can declare more than one variable of same 
in a single statement separated by comma 
For ex.:- 
int a,b,c; 
AAKASH KAUSHIK 
9891983083,9289817971
Program of sum of 2 variables 
#include<iostream.h> 
#include<conio.h> 
void main() 
{ 
clrscr(); 
int a,b,sum; 
a=10; 
b=20; 
sum=a+b; 
cout<<“value of first number”; 
cout<<a; // syntax to display value of a variable 
cout<<“value of second number”; 
cout<<b; 
cout<<“sum of numbers”; 
cout<<sum; 
getch(); 
AAKASH KAUSHIK 
} 
9891983083,9289817971
STATIC V/S DYNAMIC INTIALIZATION 
Static initialialization means when value of 
variable is already known and static initialization 
takes place at compile time. 
For ex. int a=10; 
Dynamic initialization means when value of a 
variable is decided at run time i.e., inside 
execution 
For dynamic initialization we use CIN 
AAKASH KAUSHIK 
9891983083,9289817971
SAMPLE PROGRAM OF DYNAMIC 
INTIALIZATION 
//PROGRAM TO FIND AREA OF A CIRCLE 
#include<iostream.h> 
#include<conio.h> 
void main() 
{ 
clrscr(); 
float r,area; 
cout<<“enter radius of circle”; 
cin>>r; //here value of r will be demanded at runtime 
area=3.14*r*r; 
cout<<“area of circle”; 
cout<<area; 
getch(); 
AAKASH KAUSHIK 
} 
9891983083,9289817971
Cascading of input output statements 
We can combine multiple input and output 
statements into a single one. 
For ex.:- 
int a,b,sum; 
cout<<“enter 2 numbers”; 
cin>>a>>b; 
sum=a+b; 
cout<<“Sum of ”<<a<<“ & ”<<b<<“is ”<<sum; 
AAKASH KAUSHIK 
9891983083,9289817971
DATA TYPES 
 Data type is a data storage format that can 
contain a specific type or range of values. 
 When computer programs store data in 
variables, each variable must be assigned a 
specific data type. 
 Data types represents the type of information 
that can be stored in a variable. 
 Data types are the keywords, which are used 
for Assigning a type to a variable. 
AAKASH KAUSHIK 
9891983083,9289817971
INTEGER DATA TYPES 
AAKASH KAUSHIK 
9891983083,9289817971
FLOAT/REAL DATA TYPES 
AAKASH KAUSHIK 
9891983083,9289817971
CHARACTER DATA TYPES 
AAKASH KAUSHIK 
9891983083,9289817971
EXERCISE 
Write a program to calculate sum, difference, 
product, division of two numbers. 
Write a program to find area and perimeter of 
a rectangle. 
Write a program to calculate area and 
circumference of a circle. 
Write a program to swap two numbers using 
third variable. 
Write a program to swap two numbers 
without using third variable. 
AAKASH KAUSHIK 
9891983083,9289817971
EXERCISE 
Write a program to take input marks of 5 
subjects and calculate total marks and 
average marks. 
Write a program to calculate simple interest. 
Write programs to convert temperature 
entered into Fahrenheit to Celsius and Celsius 
to Fahrenheit. 
f=(c*9/5)+32 
c=(f-32)*5/9 
AAKASH KAUSHIK 
9891983083,9289817971
THANK 
YOU 
AAKASH KAUSHIK 
9891983083,9289817971

More Related Content

What's hot

Types of function call
Types of function callTypes of function call
Types of function callArijitDhali
 
C standard library functions
C standard library functionsC standard library functions
C standard library functionsVaishnavee Sharma
 
Introducing Assignment invalidates the Substitution Model of Evaluation and v...
Introducing Assignment invalidates the Substitution Model of Evaluation and v...Introducing Assignment invalidates the Substitution Model of Evaluation and v...
Introducing Assignment invalidates the Substitution Model of Evaluation and v...Philip Schwarz
 
A2 Domain and Range
A2 Domain and RangeA2 Domain and Range
A2 Domain and Rangevhiggins1
 
Structured query language constraints
Structured query language constraintsStructured query language constraints
Structured query language constraintsVineeta Garg
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4Saranya saran
 
SQL Functions and Operators
SQL Functions and OperatorsSQL Functions and Operators
SQL Functions and OperatorsMohan Kumar.R
 
parameter passing in c#
parameter passing in c#parameter passing in c#
parameter passing in c#khush_boo31
 
IRJET- Switch Case Statements in C
IRJET-  	  Switch Case Statements in CIRJET-  	  Switch Case Statements in C
IRJET- Switch Case Statements in CIRJET Journal
 
Quick Sort , Merge Sort , Heap Sort
Quick Sort , Merge Sort ,  Heap SortQuick Sort , Merge Sort ,  Heap Sort
Quick Sort , Merge Sort , Heap SortMohammed Hussein
 
PL/SQL Coding Guidelines - Part 3
PL/SQL Coding Guidelines - Part 3PL/SQL Coding Guidelines - Part 3
PL/SQL Coding Guidelines - Part 3Larry Nung
 
Built-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric FunctionsBuilt-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric FunctionsRaj vardhan
 
Data Structures - Searching & sorting
Data Structures - Searching & sortingData Structures - Searching & sorting
Data Structures - Searching & sortingKaushal Shah
 

What's hot (20)

functions in C
functions in Cfunctions in C
functions in C
 
Types of function call
Types of function callTypes of function call
Types of function call
 
C standard library functions
C standard library functionsC standard library functions
C standard library functions
 
Basic commands in C++
Basic commands in C++Basic commands in C++
Basic commands in C++
 
Function Pointer in C
Function Pointer in CFunction Pointer in C
Function Pointer in C
 
Introducing Assignment invalidates the Substitution Model of Evaluation and v...
Introducing Assignment invalidates the Substitution Model of Evaluation and v...Introducing Assignment invalidates the Substitution Model of Evaluation and v...
Introducing Assignment invalidates the Substitution Model of Evaluation and v...
 
A2 Domain and Range
A2 Domain and RangeA2 Domain and Range
A2 Domain and Range
 
Structured query language constraints
Structured query language constraintsStructured query language constraints
Structured query language constraints
 
Arrays
ArraysArrays
Arrays
 
Single row functions
Single row functionsSingle row functions
Single row functions
 
Merge sort
Merge sortMerge sort
Merge sort
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
SQL Functions and Operators
SQL Functions and OperatorsSQL Functions and Operators
SQL Functions and Operators
 
parameter passing in c#
parameter passing in c#parameter passing in c#
parameter passing in c#
 
IRJET- Switch Case Statements in C
IRJET-  	  Switch Case Statements in CIRJET-  	  Switch Case Statements in C
IRJET- Switch Case Statements in C
 
Quick Sort , Merge Sort , Heap Sort
Quick Sort , Merge Sort ,  Heap SortQuick Sort , Merge Sort ,  Heap Sort
Quick Sort , Merge Sort , Heap Sort
 
C++ lecture 03
C++   lecture 03C++   lecture 03
C++ lecture 03
 
PL/SQL Coding Guidelines - Part 3
PL/SQL Coding Guidelines - Part 3PL/SQL Coding Guidelines - Part 3
PL/SQL Coding Guidelines - Part 3
 
Built-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric FunctionsBuilt-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric Functions
 
Data Structures - Searching & sorting
Data Structures - Searching & sortingData Structures - Searching & sorting
Data Structures - Searching & sorting
 

Viewers also liked

Viewers also liked (18)

Inheritance question class 12th
Inheritance question class 12thInheritance question class 12th
Inheritance question class 12th
 
Fundamentals of c programming
Fundamentals of c programmingFundamentals of c programming
Fundamentals of c programming
 
C Programming basics
C Programming basicsC Programming basics
C Programming basics
 
C PROGRAMMING BASICS- COMPUTER PROGRAMMING UNIT II
C PROGRAMMING BASICS- COMPUTER PROGRAMMING UNIT IIC PROGRAMMING BASICS- COMPUTER PROGRAMMING UNIT II
C PROGRAMMING BASICS- COMPUTER PROGRAMMING UNIT II
 
Java programming-Event Handling
Java programming-Event HandlingJava programming-Event Handling
Java programming-Event Handling
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
Java Basics
Java BasicsJava Basics
Java Basics
 
02 java basics
02 java basics02 java basics
02 java basics
 
Data types
Data typesData types
Data types
 
Installing Operating System
Installing Operating System Installing Operating System
Installing Operating System
 
Basics of Java
Basics of JavaBasics of Java
Basics of Java
 
02 basic java programming and operators
02 basic java programming and operators02 basic java programming and operators
02 basic java programming and operators
 
C ppt
C pptC ppt
C ppt
 
Operating System Mac OS X
Operating System Mac OS XOperating System Mac OS X
Operating System Mac OS X
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
C language (Collected By Dushmanta)
C language  (Collected By Dushmanta)C language  (Collected By Dushmanta)
C language (Collected By Dushmanta)
 

Similar to C++ Variables and Data Types Guide

c++ programming Unit 4 operators
c++ programming Unit 4 operatorsc++ programming Unit 4 operators
c++ programming Unit 4 operatorsAAKASH KUMAR
 
C++ programming Unit 5 flow of control
C++ programming Unit 5 flow of controlC++ programming Unit 5 flow of control
C++ programming Unit 5 flow of controlAAKASH KUMAR
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2Warui Maina
 
Reference Parameter, Passing object by reference, constant parameter & Defaul...
Reference Parameter, Passing object by reference, constant parameter & Defaul...Reference Parameter, Passing object by reference, constant parameter & Defaul...
Reference Parameter, Passing object by reference, constant parameter & Defaul...Meghaj Mallick
 
Data manipulation on r
Data manipulation on rData manipulation on r
Data manipulation on rAbhik Seal
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overviewsapdocs. info
 
Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02wingsrai
 
Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01tabish
 
chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01tabish
 
Chapter 1 Abap Programming Overview
Chapter 1 Abap Programming OverviewChapter 1 Abap Programming Overview
Chapter 1 Abap Programming OverviewAshish Kumar
 
Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02tabish
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical FileAshwin Francis
 
Assignment Details There is a .h file on Moodle that provides a defi.pdf
Assignment Details There is a .h file on Moodle that provides a defi.pdfAssignment Details There is a .h file on Moodle that provides a defi.pdf
Assignment Details There is a .h file on Moodle that provides a defi.pdfjyothimuppasani1
 

Similar to C++ Variables and Data Types Guide (20)

c++ programming Unit 4 operators
c++ programming Unit 4 operatorsc++ programming Unit 4 operators
c++ programming Unit 4 operators
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
U3.pptx
U3.pptxU3.pptx
U3.pptx
 
unit 3 ppt.pptx
unit 3 ppt.pptxunit 3 ppt.pptx
unit 3 ppt.pptx
 
C++ programming Unit 5 flow of control
C++ programming Unit 5 flow of controlC++ programming Unit 5 flow of control
C++ programming Unit 5 flow of control
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2
 
Reference Parameter, Passing object by reference, constant parameter & Defaul...
Reference Parameter, Passing object by reference, constant parameter & Defaul...Reference Parameter, Passing object by reference, constant parameter & Defaul...
Reference Parameter, Passing object by reference, constant parameter & Defaul...
 
C pointers and references
C pointers and referencesC pointers and references
C pointers and references
 
Unit 6 pointers
Unit 6   pointersUnit 6   pointers
Unit 6 pointers
 
SAS functions.pptx
SAS functions.pptxSAS functions.pptx
SAS functions.pptx
 
Data manipulation on r
Data manipulation on rData manipulation on r
Data manipulation on r
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overview
 
Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02
 
Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01
 
chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01
 
Chapter 1 Abap Programming Overview
Chapter 1 Abap Programming OverviewChapter 1 Abap Programming Overview
Chapter 1 Abap Programming Overview
 
Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02
 
Ch3
Ch3Ch3
Ch3
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
Assignment Details There is a .h file on Moodle that provides a defi.pdf
Assignment Details There is a .h file on Moodle that provides a defi.pdfAssignment Details There is a .h file on Moodle that provides a defi.pdf
Assignment Details There is a .h file on Moodle that provides a defi.pdf
 

More from AAKASH KUMAR

NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...AAKASH KUMAR
 
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CSAAKASH KUMAR
 
Inheritance question
Inheritance questionInheritance question
Inheritance questionAAKASH KUMAR
 
Header file BASED QUESTION- CBSE CS CLASS 12TH
Header file BASED QUESTION- CBSE CS CLASS 12THHeader file BASED QUESTION- CBSE CS CLASS 12TH
Header file BASED QUESTION- CBSE CS CLASS 12THAAKASH KUMAR
 
Constructor & destructor based question- cbse cs class 12th
Constructor & destructor based question-  cbse cs class 12thConstructor & destructor based question-  cbse cs class 12th
Constructor & destructor based question- cbse cs class 12thAAKASH KUMAR
 
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAMCHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAMAAKASH KUMAR
 
Practical exam special- CBSE CS CLASS 12th
Practical exam special- CBSE CS CLASS 12thPractical exam special- CBSE CS CLASS 12th
Practical exam special- CBSE CS CLASS 12thAAKASH KUMAR
 
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CSAAKASH KUMAR
 
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...AAKASH KUMAR
 
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...AAKASH KUMAR
 
Power point2007instruction
Power point2007instructionPower point2007instruction
Power point2007instructionAAKASH KUMAR
 
Html introduction Part-2
Html introduction Part-2Html introduction Part-2
Html introduction Part-2AAKASH KUMAR
 
Evolution / history of Computer
Evolution / history of ComputerEvolution / history of Computer
Evolution / history of ComputerAAKASH KUMAR
 
Array within a class
Array within a classArray within a class
Array within a classAAKASH KUMAR
 
Input Output Devices and Memory Unit
Input Output Devices and Memory UnitInput Output Devices and Memory Unit
Input Output Devices and Memory UnitAAKASH KUMAR
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programAAKASH KUMAR
 

More from AAKASH KUMAR (20)

NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...
 
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 2) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
 
Inheritance question
Inheritance questionInheritance question
Inheritance question
 
Header file BASED QUESTION- CBSE CS CLASS 12TH
Header file BASED QUESTION- CBSE CS CLASS 12THHeader file BASED QUESTION- CBSE CS CLASS 12TH
Header file BASED QUESTION- CBSE CS CLASS 12TH
 
Constructor & destructor based question- cbse cs class 12th
Constructor & destructor based question-  cbse cs class 12thConstructor & destructor based question-  cbse cs class 12th
Constructor & destructor based question- cbse cs class 12th
 
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAMCHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
CHOOSE THE CORRECT IDENTIFIER - Q.1 CBSE CS EXAM
 
Practical exam special- CBSE CS CLASS 12th
Practical exam special- CBSE CS CLASS 12thPractical exam special- CBSE CS CLASS 12th
Practical exam special- CBSE CS CLASS 12th
 
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
2 d array(part 1) || 2D ARRAY FUNCTION WRITING || GET 100% MARKS IN CBSE CS
 
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
 
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
 
Ms word Part 2
Ms  word Part 2Ms  word Part 2
Ms word Part 2
 
Ms word Part 1
Ms  word Part 1Ms  word Part 1
Ms word Part 1
 
Power point2007instruction
Power point2007instructionPower point2007instruction
Power point2007instruction
 
Html introduction Part-2
Html introduction Part-2Html introduction Part-2
Html introduction Part-2
 
Html Slide Part-1
Html Slide Part-1Html Slide Part-1
Html Slide Part-1
 
Evolution / history of Computer
Evolution / history of ComputerEvolution / history of Computer
Evolution / history of Computer
 
computer system
computer system computer system
computer system
 
Array within a class
Array within a classArray within a class
Array within a class
 
Input Output Devices and Memory Unit
Input Output Devices and Memory UnitInput Output Devices and Memory Unit
Input Output Devices and Memory Unit
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ program
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
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
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
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
 

Recently uploaded (20)

Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
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 Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
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
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
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
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 

C++ Variables and Data Types Guide

  • 1. C++ Language By:-AAKASH KAUSHIK #9289817971, 98919893083 Email-theaakashkumar@gmail.com
  • 2. UNIT -3 VARIABLES & DATA TYPES
  • 3. VARIABLES Variables are used to store values. Variables are name of storage location where data of particular type can be stored. Variables stores the latest updated value. We can use any valid Identifier as a variable name. AAKASH KAUSHIK 9891983083,9289817971
  • 4. DECLARATION OF VARIABLES Declaration syntax:- Datatype variablename; Where data type could be any valid Data type for ex.- int, char, float, etc. and variable name could be any valid identifier. For ex. int a; char b; float c; AAKASH KAUSHIK 9891983083,9289817971
  • 5. INTIALIZATION OF VARIABLES Intialization means assigning value to declared variable. For ex:- a=10; b=‘A’; c=3.14; AAKASH KAUSHIK 9891983083,9289817971
  • 6. MORE ON DECLARATION AND INTIALIZATION Declaration and initialization can take place in same statement also. For ex.:- int a=10; We can declare more than one variable of same in a single statement separated by comma For ex.:- int a,b,c; AAKASH KAUSHIK 9891983083,9289817971
  • 7. Program of sum of 2 variables #include<iostream.h> #include<conio.h> void main() { clrscr(); int a,b,sum; a=10; b=20; sum=a+b; cout<<“value of first number”; cout<<a; // syntax to display value of a variable cout<<“value of second number”; cout<<b; cout<<“sum of numbers”; cout<<sum; getch(); AAKASH KAUSHIK } 9891983083,9289817971
  • 8. STATIC V/S DYNAMIC INTIALIZATION Static initialialization means when value of variable is already known and static initialization takes place at compile time. For ex. int a=10; Dynamic initialization means when value of a variable is decided at run time i.e., inside execution For dynamic initialization we use CIN AAKASH KAUSHIK 9891983083,9289817971
  • 9. SAMPLE PROGRAM OF DYNAMIC INTIALIZATION //PROGRAM TO FIND AREA OF A CIRCLE #include<iostream.h> #include<conio.h> void main() { clrscr(); float r,area; cout<<“enter radius of circle”; cin>>r; //here value of r will be demanded at runtime area=3.14*r*r; cout<<“area of circle”; cout<<area; getch(); AAKASH KAUSHIK } 9891983083,9289817971
  • 10. Cascading of input output statements We can combine multiple input and output statements into a single one. For ex.:- int a,b,sum; cout<<“enter 2 numbers”; cin>>a>>b; sum=a+b; cout<<“Sum of ”<<a<<“ & ”<<b<<“is ”<<sum; AAKASH KAUSHIK 9891983083,9289817971
  • 11. DATA TYPES  Data type is a data storage format that can contain a specific type or range of values.  When computer programs store data in variables, each variable must be assigned a specific data type.  Data types represents the type of information that can be stored in a variable.  Data types are the keywords, which are used for Assigning a type to a variable. AAKASH KAUSHIK 9891983083,9289817971
  • 12. INTEGER DATA TYPES AAKASH KAUSHIK 9891983083,9289817971
  • 13. FLOAT/REAL DATA TYPES AAKASH KAUSHIK 9891983083,9289817971
  • 14. CHARACTER DATA TYPES AAKASH KAUSHIK 9891983083,9289817971
  • 15. EXERCISE Write a program to calculate sum, difference, product, division of two numbers. Write a program to find area and perimeter of a rectangle. Write a program to calculate area and circumference of a circle. Write a program to swap two numbers using third variable. Write a program to swap two numbers without using third variable. AAKASH KAUSHIK 9891983083,9289817971
  • 16. EXERCISE Write a program to take input marks of 5 subjects and calculate total marks and average marks. Write a program to calculate simple interest. Write programs to convert temperature entered into Fahrenheit to Celsius and Celsius to Fahrenheit. f=(c*9/5)+32 c=(f-32)*5/9 AAKASH KAUSHIK 9891983083,9289817971
  • 17. THANK YOU AAKASH KAUSHIK 9891983083,9289817971