
C Code, C Code Break 107
Program 71: Unsynchronized
The assignment here is to make a four-function calculator. The user is supposed
to type in an operator and a number, and the calculator goes to work. For
example:
Enter operator and value: + 10
Total: 10
But things don’t go as expected.
1 /************************************************
2 * calc -- Simple 4 function calculator. *
3* *
4 * Usage: *
5 * $ calc *
6 * Enter operator and value: + 5 *
7* *
8 * At the end of each operation the acculated *
9 * results are printed. *
10 ************************************************/
11 #include <stdio.h>
12 #include <stdlib.h>
13 int main() {
14 char oper; /* Operato ...