Thursday, 11 May 2017
Functions In C++ part 6 [30]
#include<constream.h>
#include<iomanip.h>
void add(int,int);
void subtraction(int,int);
void mult(int,int);
void div(int ,int);
void main(){
clrscr();
cout<<"--------- MENU ---------"<<endl;
cout<<"a : ADDITION"<<endl;
cout<<"m : MULTIPLICATION"<<endl;
cout<<"d : DIVISION"<<endl;
cout<<"s : SUBTRACTION"<<endl;
cout<<"e : EXIT"<<endl;
cout<<"--------- END ---------"<<endl;
char choice;
cout<<"plzz enter your choice"<<endl;
cin>>choice;
int num1,num2;
switch(choice)
{
case 'a':
cout<<"plzz enter number";
cin>>num1;
cout<<"plzz enter number";
cin>>num2;
add(num1,num2);
break;
case 'm':
cout<<"plzz enter number";
cin>>num1;
cout<<"plzz enter number";
cin>>num2;
mult(num1,num2);
break;
case 'd':
cout<<"plzz enter number";
cin>>num1;
cout<<"plzz enter number";
cin>>num2;
div(num1,num2);
break;
case 's':
cout<<"plzz enter number";
cin>>num1;
cout<<"plzz enter number";
cin>>num2;
subtraction(num1,num2);
break;
}
getch();
}
void add(int a,int b)
{
cout<<"Result = "<<a+b;
}
void subtraction(int a,int b)
{
cout<<"Result = "<<a-b;
}
void mult(int a,int b)
{
cout<<"Result = "<<a*b;
}
void div(int a,int b)
{
cout<<"Result = "<<a/b;
}
Labels:
C++,
c++ full course,
c++ projects,
c++ videos,
cplus,
hindi,
in Urdu
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment