#include<iostream.h>
#include<conio.h>
void dispfun();
void main()
{
clrscr();
dispfun();
dispfun();
getch();
}
void dispfun()
{
cout<<”Demonstration for a function call”<<endl;
return;
}
#include<iostream.h>
#include<conio.h>
int sum(int,int);
int sum(int,int,int);
void main()
{
int fun1,fun2;
clrscr();
fun1=sum(3,4);
fun2=sum(4,5,6);
cout<<”Sum(3,4)=”<<fun1<<endl;
cout<<”Sum(4,5,6)=”<<fun2<<endl;
getch();
}
int sum(int a,int b)
{
return a+b;
}
int sum(int a,int b,int c)
{
return a+b+c;
}
#include<iostream.h>
#include<conio.h>
int sum(int x=10,int y=20,int z=30);
void main()
{
clrscr();
cout<<”Sum()=”<<sum()<<endl;
cout<<”Sum(15)=”<<sum(15)<<endl;
cout<<”Sum(15,25)=”<<sum(15,25)<<endl;
cout<<”Sum(15,25,35)=”<<sum(15,25,35)<<endl;
getch();
}
int sum(int x,int y,int z)
{
return x+y+z;
}
No comments:
Post a Comment