Computer Science, asked by bsk822528gmailcom, 9 months ago

write a program to perform arithmetic operation using inline function​

Answers

Answered by namanagarwal76
0

Answer:

Inline Function: It is a function that is expanded in line when it is invoked . That is the complier replaces the function call with the corresponding function code.

The inline function is defined as follows

Inline return-type function_ name( arguments)

{

function body;

}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

inline float mul( float a, float b)

{

return(a*b);

}

inline float div(float a, float b)

{

return(a/b) ;

}

int main ()

{

float x,y;

cout<<"enter the value of x:";

cin>>x;

cout<<"enter the value of y:";

cin>>y;

cout<<mul(x,y)<<"\n";

cout<<div(x,y)<<"\n";

getch();

}

OUTPUT:

enter the value of x:10

enter the value of y:20

200

0.5

Similar questions