#include<iostream.h>
#include<conio.h>
void main()
{
textcolor(RED);
textbackground(BLUE+GREEN);
clrscr();
float a,b,d;
char c;
cout<<“Enter first no. a = “;
cin>>a;
cout<<“Enter second no. b = “;
cin>>b;
cout<<“Enter the Operator “;
cin>>c;
switch (c)
{ case ‘+’:
d=a+b;
clrscr();
cout<<“Sum of the digits = “<<d;
break;
case ‘-‘:
d=a-b;
clrscr();
cout<<“Difference = “<<d;
break;
case ‘*’:
d=a*b;
clrscr();
cout<<“Product = “<<d;
break;
case ‘/’:
d=a/b;
clrscr();
cout<<“Quotient = “<<d;
break;
default:
cout<<“!!!!!!!!!!!!!! Error”<<“\n”<<“Enter corrrect values”;
break;
}
getch();
}
#include<conio.h>
void main()
{
textcolor(RED);
textbackground(BLUE+GREEN);
clrscr();
float a,b,d;
char c;
cout<<“Enter first no. a = “;
cin>>a;
cout<<“Enter second no. b = “;
cin>>b;
cout<<“Enter the Operator “;
cin>>c;
switch (c)
{ case ‘+’:
d=a+b;
clrscr();
cout<<“Sum of the digits = “<<d;
break;
case ‘-‘:
d=a-b;
clrscr();
cout<<“Difference = “<<d;
break;
case ‘*’:
d=a*b;
clrscr();
cout<<“Product = “<<d;
break;
case ‘/’:
d=a/b;
clrscr();
cout<<“Quotient = “<<d;
break;
default:
cout<<“!!!!!!!!!!!!!! Error”<<“\n”<<“Enter corrrect values”;
break;
}
getch();
}
No comments:
Post a Comment