SlideShare a Scribd company logo
1 of 23
FUNCTIONS
In C++
Introduction
• Functions are the main tool of Structured Programming.
• Functions decrease the size of program by calling the function at different
places in the program.
See the Syntax in C:
void show ();
main()
{
show ();
}
void show ()
{
………………
}
• Basically Functions in C and C++ have the same importance and the
applications.
• Also in C++ functions and the operators can be
Overloaded.
MAIN Function:
• No return type for main() in C.
• In C++ main() always returns an integer value to the operating system.
• That is why we always have a return() statement at the end of the main().
• Operating system checks the return value as the function has been
successfully executed or not.
Function Prototyping
• Function Prototype is a kind of template that is used by compiler to ensure
that proper arguments are passed and return value is treated correctly.
• Earlier C did not has the prototyping, It was firstly introduced in C++ then
it was adopted in ANSI C. However it is optional in C but compulsory in
C++.
returntype function name (argument list)
• The names of the arguments are optional in declaration but must in the
function definition.
Call by Reference
• When the values are passed to the functions they are using the copies of the original
variables. It will create a problem when we have to change the original variables.
• But in case of Call be Reference we pass the addresses of the variables hence all the
operations are performed on the original variables.
• Example: Swapping
void swap(int a, int b)
{ int t;
t=a;
a=b;
b=t;
}
swap(m,n);
void swap(int *a, int *b)
{ int
t=*a;
*a=*b;
*b=t;
}
Swap(&x, &y);
Return by Reference
int & max(int x, int y)
{
if (x>y)
return x;
else
return y;
}
This function will return the address of either x or y.
Inline Functions
• When a function is called substantial time is wasted the shifting of the
control. It adds more overheads when the size of the function is very small.
• One alternative to it is Macros, but their errors are not checked during the
compilation.
• In C++ we have inline functions. Here the compiler replaces the function
call with the corresponding function code.
inline function-header
{ function body }
inline float cube(float a)
{
return(a*a*a);
}
Calling:
c=cube(3.0);
d=cube(2.5+1.5);
Inline Functions contd..
• The Inline functions are advantageous only when the size of the function is
too small, if we use the same technique for the bigger functions the benefits
of the Inline functions will be lost.
• In case of Inline function the control doesn't go any where.
• The Inline Keyword is just a request to the compiler not the command, the
compiler may ignore the request if the size of the function is too large,
Then it will be treated as normal functions.
• The Inline will not work in the following cases;
1. Functions having the loop, switch or goto statement.
2. Functions not returning any values if a return statement exists.
3. If functions have static variables.
4. If functions are recursive.
Using the Inline functions every time the function is invoked new memory is
allocated so trade-off becomes necessary.
Default Arguments
• We can call a function in C++, without specifying all the arguments.
• We can give some default values in the function prototype.
float amount(float p, int t, float rate =0.15);
Now if we call value = amount(5000,7);
Then internally It will be converted into
value = amount(5000,7,0.15);
• Important here is that the default values must be added from right to left.
Const Arguments
• This tells the compiler that the function should not modify the argument.
int strlen (const char *p);
int length (const string &s);
Specially it is used when we pass arguments as reference of as pointers.
Inline functions
• An inline function is a function that is
expanded in line when it is invoked.
• That is, the compiler replaces the function call
with function definition.
Why do we use inline functions
• Every time a function is called it takes a lot of
extra time in executing series of instructions
for tasks such as jumping to function, saving
registers, returning to calling function.
• When function is small, huge execution time is
spent in such overheads
• To eliminate the cost of calling small
functions, INLINE functions are used.
SYNTAX
Inline function-header
{
Function body
}
Example
inline float square(float x)
{
return x*x;
}
void main()
{
float a,y;
a=square(y);
}
• During compilation this
code is treated as:
void main()
{
float a,y;
a=y*y;
}
• While making inline functions all we need to
do is to prefix the keyword inline to function
definition.
• All inline functions must be defined
before they are called.
• Usually, the functions are made inline
when they are small enough to be
defined in 1 or 2 lines.
Situations where inline expansion may
not work:
• For functions returning values, if a loop, a
switch or a goto exists.
• For functions not returning value, if a return
statement exists.
• If function contains static variables
• If inline functions are recursive.
Illustration
• #include<iostream.h>
• #include<conio.h>
• inline int mult(int x,int y)
• {
• return(x*y);
• }
• inline int sum(int a,int b)
• {
• return(a+b);
• }
• int main()
• {
• int p,q;
• cout<<mult(p,q);
• cout<<sum(p,q);
• return 0;
• }
Default arguments
• To call a function without specifying its
arguments.
• In such cases, function assigns a default value
to the parameter which does not have a
matching arguments in the function call.
• Default values are specified when function is
declared.
Example of function declaration with
default values
float amount(float principal,int time,int rate=2);
// default value of 2 is assigned to rate
Amount(5000,5);
// this function call passes value of 5000 to
principal and 5 to time and function uses
default value of 2 for rate.
Amount(5000,5,1); //no missing argument,it
passes an explicit value of 1 to rate
• NOTE: only trailing arguments can have
default values.
• We must add default values from right to left.
We can not provide default value to an
argument in the middle of argument list.
int sum(int i, int j=5, int k=9); //Right
int sum(int i=5, int j); //wrong
int sum(int i=0, int j; int k=5); //wrong
Advantages
• We can use default arguments to add new
parameters to existing functions.
• Default arguments can be used to combine
similar functions into one.
Function Overloading
• Overloading; Using the same thing for different purposes.
When a same function name performs a variety of tasks is also
called function polymorphism in OOP.
• The operation to be performed by the function will depend upon the type
and the no. of arguments passed to the function. It is done like this :
1. The compiler will try to find the exact match, actual type and no. of
arguments.
2. If not the compiler uses integral promotions
char to int
float to double
3 Then built in conversions are done, and if there is no match then compiler
will generate an error message.
Precautions:
1. Unrelated functions should not be overloaded.
2. Default arguments can be used sometimes at place of overloading.
Function Overloading
• #include<iostream.h>
int volume (int);
double volume (double, int);
long volume (long, int, int);
int main()
{
cout<<Volume(10)<<“n”;
cout<<Volume(2.5,8)<<“n”;
cout<<Volume(100L,75,15)<<“n”;
return 0;
}
Int volume(int s)
{ return(s*s*s);
}
Int volume(double r, int h)
{ return(3.14519*r*r*h);
}
Int volume(long I, int b, int h)
{ return(l*b*h);
}
Output
1000
157.26
112500

More Related Content

Similar to Function in C++, Methods in C++ coding programming

Similar to Function in C++, Methods in C++ coding programming (20)

Functions in C++.pdf
Functions in C++.pdfFunctions in C++.pdf
Functions in C++.pdf
 
CHAPTER THREE FUNCTION.pptx
CHAPTER THREE FUNCTION.pptxCHAPTER THREE FUNCTION.pptx
CHAPTER THREE FUNCTION.pptx
 
Inline function
Inline functionInline function
Inline function
 
CH.4FUNCTIONS IN C (1).pptx
CH.4FUNCTIONS IN C (1).pptxCH.4FUNCTIONS IN C (1).pptx
CH.4FUNCTIONS IN C (1).pptx
 
Functions
FunctionsFunctions
Functions
 
arrays.ppt
arrays.pptarrays.ppt
arrays.ppt
 
Functions IN CPROGRAMMING OF ENGINEERING.pptx
Functions IN CPROGRAMMING OF ENGINEERING.pptxFunctions IN CPROGRAMMING OF ENGINEERING.pptx
Functions IN CPROGRAMMING OF ENGINEERING.pptx
 
3d7b7 session4 c++
3d7b7 session4 c++3d7b7 session4 c++
3d7b7 session4 c++
 
User Defined Functions
User Defined FunctionsUser Defined Functions
User Defined Functions
 
Unit 7. Functions
Unit 7. FunctionsUnit 7. Functions
Unit 7. Functions
 
PSPC-UNIT-4.pdf
PSPC-UNIT-4.pdfPSPC-UNIT-4.pdf
PSPC-UNIT-4.pdf
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
unit_2 (1).pptx
unit_2 (1).pptxunit_2 (1).pptx
unit_2 (1).pptx
 
Modular Programming in C
Modular Programming in CModular Programming in C
Modular Programming in C
 
Functions-.pdf
Functions-.pdfFunctions-.pdf
Functions-.pdf
 
Functions and modular programming.pptx
Functions and modular programming.pptxFunctions and modular programming.pptx
Functions and modular programming.pptx
 
C++ Functions.ppt
C++ Functions.pptC++ Functions.ppt
C++ Functions.ppt
 
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM) FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 
Functions
Functions Functions
Functions
 
Thinking in Functions
Thinking in FunctionsThinking in Functions
Thinking in Functions
 

Recently uploaded

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 

Recently uploaded (20)

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 

Function in C++, Methods in C++ coding programming

  • 2. Introduction • Functions are the main tool of Structured Programming. • Functions decrease the size of program by calling the function at different places in the program. See the Syntax in C: void show (); main() { show (); } void show () { ……………… }
  • 3. • Basically Functions in C and C++ have the same importance and the applications. • Also in C++ functions and the operators can be Overloaded. MAIN Function: • No return type for main() in C. • In C++ main() always returns an integer value to the operating system. • That is why we always have a return() statement at the end of the main(). • Operating system checks the return value as the function has been successfully executed or not.
  • 4. Function Prototyping • Function Prototype is a kind of template that is used by compiler to ensure that proper arguments are passed and return value is treated correctly. • Earlier C did not has the prototyping, It was firstly introduced in C++ then it was adopted in ANSI C. However it is optional in C but compulsory in C++. returntype function name (argument list) • The names of the arguments are optional in declaration but must in the function definition.
  • 5. Call by Reference • When the values are passed to the functions they are using the copies of the original variables. It will create a problem when we have to change the original variables. • But in case of Call be Reference we pass the addresses of the variables hence all the operations are performed on the original variables. • Example: Swapping void swap(int a, int b) { int t; t=a; a=b; b=t; } swap(m,n); void swap(int *a, int *b) { int t=*a; *a=*b; *b=t; } Swap(&x, &y);
  • 6. Return by Reference int & max(int x, int y) { if (x>y) return x; else return y; } This function will return the address of either x or y.
  • 7. Inline Functions • When a function is called substantial time is wasted the shifting of the control. It adds more overheads when the size of the function is very small. • One alternative to it is Macros, but their errors are not checked during the compilation. • In C++ we have inline functions. Here the compiler replaces the function call with the corresponding function code. inline function-header { function body } inline float cube(float a) { return(a*a*a); } Calling: c=cube(3.0); d=cube(2.5+1.5);
  • 8. Inline Functions contd.. • The Inline functions are advantageous only when the size of the function is too small, if we use the same technique for the bigger functions the benefits of the Inline functions will be lost. • In case of Inline function the control doesn't go any where. • The Inline Keyword is just a request to the compiler not the command, the compiler may ignore the request if the size of the function is too large, Then it will be treated as normal functions. • The Inline will not work in the following cases; 1. Functions having the loop, switch or goto statement. 2. Functions not returning any values if a return statement exists. 3. If functions have static variables. 4. If functions are recursive. Using the Inline functions every time the function is invoked new memory is allocated so trade-off becomes necessary.
  • 9. Default Arguments • We can call a function in C++, without specifying all the arguments. • We can give some default values in the function prototype. float amount(float p, int t, float rate =0.15); Now if we call value = amount(5000,7); Then internally It will be converted into value = amount(5000,7,0.15); • Important here is that the default values must be added from right to left.
  • 10. Const Arguments • This tells the compiler that the function should not modify the argument. int strlen (const char *p); int length (const string &s); Specially it is used when we pass arguments as reference of as pointers.
  • 11. Inline functions • An inline function is a function that is expanded in line when it is invoked. • That is, the compiler replaces the function call with function definition.
  • 12. Why do we use inline functions • Every time a function is called it takes a lot of extra time in executing series of instructions for tasks such as jumping to function, saving registers, returning to calling function. • When function is small, huge execution time is spent in such overheads • To eliminate the cost of calling small functions, INLINE functions are used.
  • 14. Example inline float square(float x) { return x*x; } void main() { float a,y; a=square(y); } • During compilation this code is treated as: void main() { float a,y; a=y*y; }
  • 15. • While making inline functions all we need to do is to prefix the keyword inline to function definition. • All inline functions must be defined before they are called. • Usually, the functions are made inline when they are small enough to be defined in 1 or 2 lines.
  • 16. Situations where inline expansion may not work: • For functions returning values, if a loop, a switch or a goto exists. • For functions not returning value, if a return statement exists. • If function contains static variables • If inline functions are recursive.
  • 17. Illustration • #include<iostream.h> • #include<conio.h> • inline int mult(int x,int y) • { • return(x*y); • } • inline int sum(int a,int b) • { • return(a+b); • } • int main() • { • int p,q; • cout<<mult(p,q); • cout<<sum(p,q); • return 0; • }
  • 18. Default arguments • To call a function without specifying its arguments. • In such cases, function assigns a default value to the parameter which does not have a matching arguments in the function call. • Default values are specified when function is declared.
  • 19. Example of function declaration with default values float amount(float principal,int time,int rate=2); // default value of 2 is assigned to rate Amount(5000,5); // this function call passes value of 5000 to principal and 5 to time and function uses default value of 2 for rate. Amount(5000,5,1); //no missing argument,it passes an explicit value of 1 to rate
  • 20. • NOTE: only trailing arguments can have default values. • We must add default values from right to left. We can not provide default value to an argument in the middle of argument list. int sum(int i, int j=5, int k=9); //Right int sum(int i=5, int j); //wrong int sum(int i=0, int j; int k=5); //wrong
  • 21. Advantages • We can use default arguments to add new parameters to existing functions. • Default arguments can be used to combine similar functions into one.
  • 22. Function Overloading • Overloading; Using the same thing for different purposes. When a same function name performs a variety of tasks is also called function polymorphism in OOP. • The operation to be performed by the function will depend upon the type and the no. of arguments passed to the function. It is done like this : 1. The compiler will try to find the exact match, actual type and no. of arguments. 2. If not the compiler uses integral promotions char to int float to double 3 Then built in conversions are done, and if there is no match then compiler will generate an error message. Precautions: 1. Unrelated functions should not be overloaded. 2. Default arguments can be used sometimes at place of overloading.
  • 23. Function Overloading • #include<iostream.h> int volume (int); double volume (double, int); long volume (long, int, int); int main() { cout<<Volume(10)<<“n”; cout<<Volume(2.5,8)<<“n”; cout<<Volume(100L,75,15)<<“n”; return 0; } Int volume(int s) { return(s*s*s); } Int volume(double r, int h) { return(3.14519*r*r*h); } Int volume(long I, int b, int h) { return(l*b*h); } Output 1000 157.26 112500