SIMPLE EXAMPLE OF PROCESS HEADER FILE
Write a simple program of addition,multiplication,subtraction and division using process header file :)))
#include<iostream.h>
#include<conio.h>
#include<process.h>
int add(int a,int b)
{
int sum;
sum=a+b;
return sum;
}
int sub(int a,int b)
{
int sum;
sum=a-b;
return sum;
}
int mul(int a,int b)
{
int sum;
sum=a*b;
return sum;
}
int div(int a,int b)
{
int sum;
sum=a/b;
return sum;
}
void main()
{
int m,n,sum,ch;
clrscr();
cout<<"\n 1. Addition \n 2. Subtraction \n 3. Multiplication \n 4. Division \n 5. Exit";
P:
cout<<"\n Enter the choice: ";
cin>>ch;
switch(ch)
{
case 1:
cout<<"\n Enter M: ";
cin>>m;
cout<<"\n Enter N: ";
cin>>n;
sum=add(m,n);
cout<<"\n Addition= "<<sum;
goto P;
case 2:
cout<<"\n Enter M: ";
cin>>m;
cout<<"\n Enter N: ";
cin>>n;
sum=sub(m,n);
cout<<"\n Subtraction= "<<sum;
goto P;
case 3:
cout<<"\n Enter M: ";
cin>>m;
cout<<"\n Enter N: ";
cin>>n;
sum=mul(m,n);
cout<<"\n Multiplication= "<<sum;
goto P;
case 4:
cout<<"\n Enter M: ";
cin>>m;
cout<<"\n Enter N: ";
cin>>n;
sum=div(m,n);
cout<<"\n Division= "<<sum;
goto P;
case 5:
exit(0);
}
getch();
}
Here is the output :)))
No comments:
Post a Comment