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
________________________________
Write a program to explain the scope of variables .
#include<iostream.h> #include<conio.h> int a = 45; void main() { clrscr(); int a=65; cout<<"a"<<a; cout<<"::a"<<::a;