#include <stdio.h>-
-
int main(void) {-
double a, b, c;-
char flag;-
int m, n, q, z;-
-
do {-
printf("---------------------\n");-
printf("easy calculator\n");-
printf("---------------------\n");-
do {-
printf("addition input '+', subtraction input '-', multiplication input '*', division input '/'\n");-
printf("please input you want:")-;
-
scanf("%c", &flag);-
-
printf("you input is %c. yes press 1. no press 0 please choose");-
scanf("%d", &z);-
} while (0 == z);-
-
if (flag == '+')-
m=1;-
-
else if (flag == '-')-
m=2;-
-
else if (flag == '*')-
m=3;-
-
else if (flag == '/')-
m=4;-
-
do {-
printf("do a %c b\n",flag);-
printf("please input a:");-
scanf("%lf",&a);-
-
printf("please input b:");-
scanf("%lf",&b);-
printf("you want do %lf %c %lf ?? yes input 1, no input 0\n", a, flag, b);-
-
scanf("%d",&q);-
} while (0 == q);-
-
switch (m) {-
case 1:-
c=a+b;-
break;-
-
case 2:-
c=a-b;-
break;-
-
case 3:-
c=a*b;-
break;-
-
case 4:-
c=a/b;-
break;-
}-
-
printf("%lf %c %lf=%lf", a, flag, b, c);-
printf("return? yes input 1, no input 0");-
scanf("%d", &n);-
}while (1 == n);-
return 0;-
}-
-
|