![](https://i-blog.csdnimg.cn/blog_migrate/47a4bb93e740236699cc0d9583089f97.png)
微信小程序算术计算
#include<conio.h>
void main()
{
clrscr();
float a,b,res;
int ch,q;
cout<<“Arithmetic Operatios”;
cout<<“nn1.Additionn2.Subtractionn3.Multiplicationn4.Divisionn5.Mode”;
cout<<“n Enter your choice:”;
cin>>ch;
switch(ch)
{
case 1:
{
cout<<“nnEnter two variables:”;
cin>>a>>b;
res=a+b;
cout<<“n Result=”<<res;
}
break;
case 2:
{
cout<<“nnEnter two variables:”;
cin>>a>>b;
res=a-b;
cout<<“n Result=”<<res;
}
break;
case 3:
{
cout<<“nnEnter two variables:”;
cin>>a>>b;
res=a*b;
cout<<“n Result=”<<res;
}
break;
case 4:
{
cout<<“nnEnter two variables:”;
cin>>a>>b;
if(a>=b)
{
res=a/b;
cout<<“n Result=”<<res;
}
else
cout<<“nnt1st varable should be greater than 2nd.!!!”;
}
break;
case 5:
{
cout<<“nnEnter two variables:”;
cin>>a>>b;
if(a>=b)
{
q=a/b;
res=a-(b*q);
cout<<“n Result=”<<res;
}
else
cout<<“nnt1st variable should be greater than 2nd..!!!”;
}
break;
}
getch();
}
翻译自: https://www.thecrazyprogrammer.com/2011/04/c-program-to-perform-all-arithmetic.html
微信小程序算术计算