标签:ret type nbsp int return turn ble operator tor
1 #include<stdio.h> 2 3 int main() 4 { 5 double value1, value2; 6 char op; 7 8 printf("Type in an expression:"); 9 scanf_s("%lf%c%lf", &value1, &op,sizeof(op), &value2); //scanf_s在输入字符时,在地址的后面要加上sizeof 10 11 if (op == ‘+‘) 12 { 13 printf("%.2f\n", value1 + value2); 14 } 15 else 16 { 17 if (op == ‘-‘) 18 { 19 printf("%.2f\n", value1 - value2); 20 } 21 else 22 { 23 if (op == ‘*‘) 24 { 25 printf("%.2f\n", value1 * value2); 26 } 27 else 28 { 29 if (op == ‘/‘) 30 { 31 printf("%.2f\n", value1 / value2); 32 } 33 else 34 { 35 printf("Unknow operator!\n"); 36 } 37 } 38 } 39 } 40 41 return 0; 42 }
标签:ret type nbsp int return turn ble operator tor
原文地址:https://www.cnblogs.com/2018jason/p/10880039.html