3.2.1程序解析例3-5输入一个形式如“操作数运算符操作数”的四则运#include<stdio.h>算表达式,输出运算结果。int main(void)double value1, value2;charop;printf("Typeinanexpression:");scanf("%if%c%lf"&value1,&op,&value2);if(op == '+)printf("=%.2fln",value1 + value2);elseif(op=='-)Type in an expression: 3.1+4.8printf("=%.2fin", value1 - value2);=7.90elseif(op ==**")printf("=%.2fin", value1 * value2);elseif(op==')printf("=%.2fin", value1 / value2);ielseprintf("Unknown operatorln");return o;3.2.1 程序解析 # include <stdio.h> int main(void) { double value1, value2; char op; printf("Type in an expression: "); scanf("%lf%c%lf", &value1, &op, &value2); if(op == '+') printf("=%.2f\n", value1 + value2); else if(op == '-') printf("=%.2f\n", value1 - value2); else if(op == '*') printf("=%.2f\n", value1 * value2); else if(op == '/') printf("=%.2f\n", value1 / value2); else printf("Unknown operator\n"); return 0; } 例3-5 输入一个形式如“操作 数 运算符 操作数”的四则运 算表达式,输出运算结果。 Type in an expression: 3.1+4.8 =7.90