1.简易计算器(实现加减乘除)
#include <stdio.h>
int main()
{
double num1;
double num2;
char operation;
double result;
printf("\nEnter the calculation:\n");
scanf("%lf%c%lf", &num1, &operation, &num2);
switch (operation)
{
case'+':
{
result = num1 + num2;
break;
}
case'-':
{
result = num1 - num2;
break;
}
case'*':
{
result = num1 * num2;
break;
}
case'/':
{
result = num1 / num2;
break;
}
}
printf("%lf", result);
return 0;
}