switch语句(用switch语句编写一个程序)
应用介绍
#include <stdio.h>int main( ){ double a, b; char op; scanf("%lf%c%lf", &a, &op, &b); switch (op) { case '+' printf("%lf - %lf = %lfn", a, b, a - b)
; break; case '*' if (b != 0) printf("%lf / %lf = %lfn", a, b, a / b)
; else printf("除数不能是0! n"); break; }}