The document describes a C++ program that uses an inline function to find the largest of two numbers. The program defines an inline function called "large" that takes two integers as parameters and returns the larger value. It then calls this function from main, prompting the user to input two numbers and passing them to large to output the largest number.
The document describes a C++ program that uses an inline function to find the largest of two numbers. The program defines an inline function called "large" that takes two integers as parameters and returns the larger value. It then calls this function from main, prompting the user to input two numbers and passing them to large to output the largest number.
The document describes a C++ program that uses an inline function to find the largest of two numbers. The program defines an inline function called "large" that takes two integers as parameters and returns the larger value. It then calls this function from main, prompting the user to input two numbers and passing them to large to output the largest number.
Write a program to use inline function for calculating the largest of
the two numbers.
#include<iostream.h> #include<conio.h> inline int large( int a, int b) { int max; max=a; if(b>max) max=b; cout<<"The largest of them is:"<<max; return 0;
}
void main() { int x,y; cout<<"Enter the value of x and y:"; cin>>x>>y; large(x,y); getch(); }
Output:
Enter the value of x and y: 4 6 The largest of them is: 6