SlideShare a Scribd company logo
1. Converting by assignment
operator
2. Using cast operator
Syntax:
(cast_type) expression;
or
cast_type (expression);
09/04/131 VIT - SCSE
Type Conversion
#include<iostream.h>
#include<conio.h>
void main()
{
char ch='A';
int x;
x=(int)ch;
cout<<x;
getch();
}
Enum Types
The enum keyword automatically enumerates a list of words
by assigning them values 0,1,2,3,4, and so on.
The general form of enum is:
enum variable_name{ list of constants separated by commas };
e.g:
enum day{sun,mon,tue,wed,thu,fri,sat};
09/04/132 VIT - SCSE
# include<iostream.h>
enum day{sun,mon,tue,wed,thu,fri,sat};
void main( )
{
day d1, d2,d3;
d1 = mon;
d2 = fri;
int diff = d2 – d1;
cout<<"days between = "<<diff<<endl;
if(d1<d2)
cout<< "day1 comes before day2n";
}
09/04/133 VIT - SCSE
Functions
A function groups a number of program statements into a
unit and gives it a name.
This unit can then be invoked from other parts of the
program.
It is used to reduce program size.
The main advantages of using a function are:
1. Easy to write a correct small function
2. Easy to read, write and debug a function
3. Easier to maintain or modify such a function
4. It can be called any number of times in any place with
different parameters
09/04/134 VIT - SCSE
09/04/135 VIT - SCSE
The Function Declaration
The Function Definition
Function Calling
Return statement
The keyword return is used to terminate function and return
a value to its caller.
The return statement may also be used to exit a function
without returning a value.
The general form of the return statement is.
 return;
 return ( expression);
09/04/136 VIT - SCSE
//using multiple return
statements in a function
# include<iostream.h>
void main()
{
float maximum( float, float, float);
float x,y,z,max;
cout<<"Enter three numbers";
cin>>x>>y>>z;
max = maximum(x,y,z);
cout<<"maximum"<<max;
}
float maximum(float a,float b,float c)
{
09/04/137 VIT - SCSE
if(a>b)
{
if(a>c)
return (a);
else
return (c);
}
else
{
if(b>c)
return (b);
else
return (c);
}
}
Types of functions
A function is invoked without passing any formal
argument does not return any value to the calling
portion.
A function is invoked with formal argument and
does not return any value to the calling portion.
A function is invoked with formal argument and
returns back a value to the calling environment.
09/04/138 VIT - SCSE
Function Arguments
The arguments can be classified into two groups:
1. Actual argument
2. Formal argument
Local and Global variable
09/04/139 VIT - SCSE
A function which calls itself directly or indirectly again and again is
known as the recursive function.
09/04/1310 VIT - SCSE
Recursive function
int sum(int n)
{
int value=0;
if(n= = 0)
return(value);
else
value = n+sum(n-1);
return(value);
}
# include<iostream.h>
void main()
{
int sum(int);
int n,temp;
cout<<"Enter any integer
number"<<endl;
cin>>n;
temp = sum(n);
cout<<"value = "<<n<<"and its
sum ="<< temp;
}
E.x: void sum(int a,int b,int c=6,int d=10);
09/04/1311 VIT - SCSE
Default arguments
void sum(int a1,int
a2,int a3,int a4)
{
int temp;
temp = a1+a2+a3+a4;
cout<<"sum="<<temp;
}
// default argument declaration
# include<iostream.h>
void sum(int a,int b,int c=6,int d=10);
//default argument
initialization
void main()
{
int a,b,c,d;
cout<<"enter any two
numbers"<<endl;
cin>>a>>b;
sum(a,b); //sum of default values
}
09/04/1312 VIT - SCSE
Function Overloading
cout<<add(5,10);
cout<<add(15,10.0);
cout<<add(12.5,7.5);
cout<<add(5.10,15);
cout<<add(0.75,5);
int add(int a,int b);
int add(int a,int b,int c);
double add(double x,double y);
double add(int p,double q);
double add(double p,int q);
09/04/1313 VIT - SCSE
Function Overloading
double volume(double r,int h)
{
return(3.14519*r*r*h);
}
long volume(long l,int b,int h)
{
return (1*b*h);
}
#include<iostream.h>
int volume(int);
double volume(double,int);
long volume(long,int,int);
main()
{
cout<<volume(10)<< endl;
cout<<volume(2.5,8)<<endl;
cout<<volume(100L,75,15);
getch();
return 0;
}
int volume(int s)
{
return (s*s*s);
}

More Related Content

What's hot

7 functions
7  functions7  functions
7 functions
MomenMostafa
 
14 strings
14 strings14 strings
14 strings
Rohit Shrivastava
 
Formatted Console I/O Operations in C++
Formatted Console I/O Operations in C++Formatted Console I/O Operations in C++
Formatted Console I/O Operations in C++
sujathavvv
 
When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)
Sylvain Hallé
 
String in c
String in cString in c
String in c
Suneel Dogra
 
Strings
StringsStrings
Strings
Dhiviya Rose
 
9 character string &amp; string library
9  character string &amp; string library9  character string &amp; string library
9 character string &amp; string library
MomenMostafa
 
Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings
Sylvain Hallé
 
Shell programming 2
Shell programming 2Shell programming 2
Shell programming 2
Gourav Varma
 
Shell programming 2
Shell programming 2Shell programming 2
Shell programming 2
Kalkey
 
Data Structure - 2nd Study
Data Structure - 2nd StudyData Structure - 2nd Study
Data Structure - 2nd Study
Chris Ohk
 
C++totural file
C++totural fileC++totural file
C++totural file
halaisumit
 
array, function, pointer, pattern matching
array, function, pointer, pattern matchingarray, function, pointer, pattern matching
array, function, pointer, pattern matching
Shakila Mahjabin
 
Aae oop xp_06
Aae oop xp_06Aae oop xp_06
Aae oop xp_06
Niit Care
 
built in function
built in functionbuilt in function
built in function
kinzasaeed4
 
C programming - String
C programming - StringC programming - String
C programming - String
Achyut Devkota
 
Lecture 2. mte 407
Lecture 2. mte 407Lecture 2. mte 407
Lecture 2. mte 407
rumanatasnim415
 
C++ tutorial
C++ tutorialC++ tutorial
6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping
MomenMostafa
 
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String ProcessingDynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Meghaj Mallick
 

What's hot (20)

7 functions
7  functions7  functions
7 functions
 
14 strings
14 strings14 strings
14 strings
 
Formatted Console I/O Operations in C++
Formatted Console I/O Operations in C++Formatted Console I/O Operations in C++
Formatted Console I/O Operations in C++
 
When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)
 
String in c
String in cString in c
String in c
 
Strings
StringsStrings
Strings
 
9 character string &amp; string library
9  character string &amp; string library9  character string &amp; string library
9 character string &amp; string library
 
Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings
 
Shell programming 2
Shell programming 2Shell programming 2
Shell programming 2
 
Shell programming 2
Shell programming 2Shell programming 2
Shell programming 2
 
Data Structure - 2nd Study
Data Structure - 2nd StudyData Structure - 2nd Study
Data Structure - 2nd Study
 
C++totural file
C++totural fileC++totural file
C++totural file
 
array, function, pointer, pattern matching
array, function, pointer, pattern matchingarray, function, pointer, pattern matching
array, function, pointer, pattern matching
 
Aae oop xp_06
Aae oop xp_06Aae oop xp_06
Aae oop xp_06
 
built in function
built in functionbuilt in function
built in function
 
C programming - String
C programming - StringC programming - String
C programming - String
 
Lecture 2. mte 407
Lecture 2. mte 407Lecture 2. mte 407
Lecture 2. mte 407
 
C++ tutorial
C++ tutorialC++ tutorial
C++ tutorial
 
6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping
 
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String ProcessingDynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
 

Viewers also liked

3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib
웅식 전
 
Do...while loop structure
Do...while loop structureDo...while loop structure
Do...while loop structure
Jd Mercado
 
Lecture13 control statementswitch.ppt
Lecture13 control statementswitch.pptLecture13 control statementswitch.ppt
Lecture13 control statementswitch.ppt
eShikshak
 
Type conversions
Type conversionsType conversions
Type conversions
sanya6900
 
Type Casting in C++
Type Casting in C++Type Casting in C++
Type Casting in C++
Sachin Sharma
 
Data Type Conversion in C++
Data Type Conversion in C++Data Type Conversion in C++
Data Type Conversion in C++
Danial Mirza
 
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
AAKASH KUMAR
 
Do While and While Loop
Do While and While LoopDo While and While Loop
Do While and While Loop
Hock Leng PUAH
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
Jin Castor
 
Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ program
matiur rahman
 
Hard disk
Hard diskHard disk
Hard disk
jazz_306
 
Hard disk PPT
Hard disk PPTHard disk PPT
Hard disk PPT
George Ranson
 

Viewers also liked (12)

3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib
 
Do...while loop structure
Do...while loop structureDo...while loop structure
Do...while loop structure
 
Lecture13 control statementswitch.ppt
Lecture13 control statementswitch.pptLecture13 control statementswitch.ppt
Lecture13 control statementswitch.ppt
 
Type conversions
Type conversionsType conversions
Type conversions
 
Type Casting in C++
Type Casting in C++Type Casting in C++
Type Casting in C++
 
Data Type Conversion in C++
Data Type Conversion in C++Data Type Conversion in C++
Data Type Conversion in C++
 
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
 
Do While and While Loop
Do While and While LoopDo While and While Loop
Do While and While Loop
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
 
Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ program
 
Hard disk
Hard diskHard disk
Hard disk
 
Hard disk PPT
Hard disk PPTHard disk PPT
Hard disk PPT
 

Similar to 4 Type conversion functions

2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
kinan keshkeh
 
6 pointers functions
6 pointers functions6 pointers functions
6 pointers functions
Docent Education
 
UNIT3.pptx
UNIT3.pptxUNIT3.pptx
UNIT3.pptx
NagasaiT
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptx
ssuser3cbb4c
 
CP 04.pptx
CP 04.pptxCP 04.pptx
CP 04.pptx
RehmanRasheed3
 
Add a function prototype for the function sumNum- # include using nam.docx
Add a function prototype for the function sumNum- # include  using nam.docxAdd a function prototype for the function sumNum- # include  using nam.docx
Add a function prototype for the function sumNum- # include using nam.docx
wviola
 
11 functions
11 functions11 functions
11 functions
Rohit Shrivastava
 
C++ Language
C++ LanguageC++ Language
C++ Language
Syed Zaid Irshad
 
C++ file
C++ fileC++ file
C++ file
Mukund Trivedi
 
C++ file
C++ fileC++ file
C++ file
Mukund Trivedi
 
how to reuse code
how to reuse codehow to reuse code
how to reuse code
jleed1
 
Function in C program
Function in C programFunction in C program
Function in C program
Nurul Zakiah Zamri Tan
 
Part 3-functions1-120315220356-phpapp01
Part 3-functions1-120315220356-phpapp01Part 3-functions1-120315220356-phpapp01
Part 3-functions1-120315220356-phpapp01
Abdul Samee
 
3. control statement
3. control statement3. control statement
3. control statement
Shankar Gangaju
 
3. chapter ii
3. chapter ii3. chapter ii
3. chapter ii
Chhom Karath
 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
Farhan Ab Rahman
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
msharshitha03s
 
Functions in c
Functions in cFunctions in c
Functions in c
KavithaMuralidharan2
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
Wingston
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
ankush_kumar
 

Similar to 4 Type conversion functions (20)

2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
 
6 pointers functions
6 pointers functions6 pointers functions
6 pointers functions
 
UNIT3.pptx
UNIT3.pptxUNIT3.pptx
UNIT3.pptx
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptx
 
CP 04.pptx
CP 04.pptxCP 04.pptx
CP 04.pptx
 
Add a function prototype for the function sumNum- # include using nam.docx
Add a function prototype for the function sumNum- # include  using nam.docxAdd a function prototype for the function sumNum- # include  using nam.docx
Add a function prototype for the function sumNum- # include using nam.docx
 
11 functions
11 functions11 functions
11 functions
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
C++ file
C++ fileC++ file
C++ file
 
C++ file
C++ fileC++ file
C++ file
 
how to reuse code
how to reuse codehow to reuse code
how to reuse code
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Part 3-functions1-120315220356-phpapp01
Part 3-functions1-120315220356-phpapp01Part 3-functions1-120315220356-phpapp01
Part 3-functions1-120315220356-phpapp01
 
3. control statement
3. control statement3. control statement
3. control statement
 
3. chapter ii
3. chapter ii3. chapter ii
3. chapter ii
 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
 

More from Docent Education

17 files and streams
17 files and streams17 files and streams
17 files and streams
Docent Education
 
16 virtual function
16 virtual function16 virtual function
16 virtual function
Docent Education
 
14 operator overloading
14 operator overloading14 operator overloading
14 operator overloading
Docent Education
 
13 exception handling
13 exception handling13 exception handling
13 exception handling
Docent Education
 
12 constructors invocation and data members initialization
12 constructors invocation and data members initialization12 constructors invocation and data members initialization
12 constructors invocation and data members initialization
Docent Education
 
12 constructors invocation and data members initialization
12 constructors invocation and data members initialization12 constructors invocation and data members initialization
12 constructors invocation and data members initialization
Docent Education
 
11 constructors in derived classes
11 constructors in derived classes11 constructors in derived classes
11 constructors in derived classes
Docent Education
 
10 inheritance
10 inheritance10 inheritance
10 inheritance
Docent Education
 
7 class objects
7 class objects7 class objects
7 class objects
Docent Education
 
5 array
5 array5 array
1 Intro Object Oriented Programming
1  Intro Object Oriented Programming1  Intro Object Oriented Programming
1 Intro Object Oriented Programming
Docent Education
 
3 intro basic_elements
3 intro basic_elements3 intro basic_elements
3 intro basic_elements
Docent Education
 
2 Intro c++
2 Intro c++2 Intro c++
2 Intro c++
Docent Education
 
unit-1-intro
 unit-1-intro unit-1-intro
unit-1-intro
Docent Education
 

More from Docent Education (14)

17 files and streams
17 files and streams17 files and streams
17 files and streams
 
16 virtual function
16 virtual function16 virtual function
16 virtual function
 
14 operator overloading
14 operator overloading14 operator overloading
14 operator overloading
 
13 exception handling
13 exception handling13 exception handling
13 exception handling
 
12 constructors invocation and data members initialization
12 constructors invocation and data members initialization12 constructors invocation and data members initialization
12 constructors invocation and data members initialization
 
12 constructors invocation and data members initialization
12 constructors invocation and data members initialization12 constructors invocation and data members initialization
12 constructors invocation and data members initialization
 
11 constructors in derived classes
11 constructors in derived classes11 constructors in derived classes
11 constructors in derived classes
 
10 inheritance
10 inheritance10 inheritance
10 inheritance
 
7 class objects
7 class objects7 class objects
7 class objects
 
5 array
5 array5 array
5 array
 
1 Intro Object Oriented Programming
1  Intro Object Oriented Programming1  Intro Object Oriented Programming
1 Intro Object Oriented Programming
 
3 intro basic_elements
3 intro basic_elements3 intro basic_elements
3 intro basic_elements
 
2 Intro c++
2 Intro c++2 Intro c++
2 Intro c++
 
unit-1-intro
 unit-1-intro unit-1-intro
unit-1-intro
 

Recently uploaded

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 

Recently uploaded (20)

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 

4 Type conversion functions

  • 1. 1. Converting by assignment operator 2. Using cast operator Syntax: (cast_type) expression; or cast_type (expression); 09/04/131 VIT - SCSE Type Conversion #include<iostream.h> #include<conio.h> void main() { char ch='A'; int x; x=(int)ch; cout<<x; getch(); }
  • 2. Enum Types The enum keyword automatically enumerates a list of words by assigning them values 0,1,2,3,4, and so on. The general form of enum is: enum variable_name{ list of constants separated by commas }; e.g: enum day{sun,mon,tue,wed,thu,fri,sat}; 09/04/132 VIT - SCSE
  • 3. # include<iostream.h> enum day{sun,mon,tue,wed,thu,fri,sat}; void main( ) { day d1, d2,d3; d1 = mon; d2 = fri; int diff = d2 – d1; cout<<"days between = "<<diff<<endl; if(d1<d2) cout<< "day1 comes before day2n"; } 09/04/133 VIT - SCSE
  • 4. Functions A function groups a number of program statements into a unit and gives it a name. This unit can then be invoked from other parts of the program. It is used to reduce program size. The main advantages of using a function are: 1. Easy to write a correct small function 2. Easy to read, write and debug a function 3. Easier to maintain or modify such a function 4. It can be called any number of times in any place with different parameters 09/04/134 VIT - SCSE
  • 5. 09/04/135 VIT - SCSE The Function Declaration The Function Definition Function Calling
  • 6. Return statement The keyword return is used to terminate function and return a value to its caller. The return statement may also be used to exit a function without returning a value. The general form of the return statement is.  return;  return ( expression); 09/04/136 VIT - SCSE
  • 7. //using multiple return statements in a function # include<iostream.h> void main() { float maximum( float, float, float); float x,y,z,max; cout<<"Enter three numbers"; cin>>x>>y>>z; max = maximum(x,y,z); cout<<"maximum"<<max; } float maximum(float a,float b,float c) { 09/04/137 VIT - SCSE if(a>b) { if(a>c) return (a); else return (c); } else { if(b>c) return (b); else return (c); } }
  • 8. Types of functions A function is invoked without passing any formal argument does not return any value to the calling portion. A function is invoked with formal argument and does not return any value to the calling portion. A function is invoked with formal argument and returns back a value to the calling environment. 09/04/138 VIT - SCSE
  • 9. Function Arguments The arguments can be classified into two groups: 1. Actual argument 2. Formal argument Local and Global variable 09/04/139 VIT - SCSE
  • 10. A function which calls itself directly or indirectly again and again is known as the recursive function. 09/04/1310 VIT - SCSE Recursive function int sum(int n) { int value=0; if(n= = 0) return(value); else value = n+sum(n-1); return(value); } # include<iostream.h> void main() { int sum(int); int n,temp; cout<<"Enter any integer number"<<endl; cin>>n; temp = sum(n); cout<<"value = "<<n<<"and its sum ="<< temp; }
  • 11. E.x: void sum(int a,int b,int c=6,int d=10); 09/04/1311 VIT - SCSE Default arguments void sum(int a1,int a2,int a3,int a4) { int temp; temp = a1+a2+a3+a4; cout<<"sum="<<temp; } // default argument declaration # include<iostream.h> void sum(int a,int b,int c=6,int d=10); //default argument initialization void main() { int a,b,c,d; cout<<"enter any two numbers"<<endl; cin>>a>>b; sum(a,b); //sum of default values }
  • 12. 09/04/1312 VIT - SCSE Function Overloading cout<<add(5,10); cout<<add(15,10.0); cout<<add(12.5,7.5); cout<<add(5.10,15); cout<<add(0.75,5); int add(int a,int b); int add(int a,int b,int c); double add(double x,double y); double add(int p,double q); double add(double p,int q);
  • 13. 09/04/1313 VIT - SCSE Function Overloading double volume(double r,int h) { return(3.14519*r*r*h); } long volume(long l,int b,int h) { return (1*b*h); } #include<iostream.h> int volume(int); double volume(double,int); long volume(long,int,int); main() { cout<<volume(10)<< endl; cout<<volume(2.5,8)<<endl; cout<<volume(100L,75,15); getch(); return 0; } int volume(int s) { return (s*s*s); }