blob: ac24b60ad342c3dd80fd32a8ccd2a08d145873d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#include <stdio.h>
#include <string.h>
#define MAXOP 100
#define MAXLINE 1000
#define NUM '0'
#define FUN '1'
#define ASG '2'
#define VAR '3'
int getop(char[]);
void push(double);
double peek();
double pop();
void clear();
int main(int argc, char *argv[]) {
int type;
char s[MAXOP];
printf("Press CTRL+C to exit\n");
while (type == getop(s)) {
switch (type) {
case NUM:
break;
case '+':
break;
case '-':
break;
case '*':
break;
case '/':
break;
case '%':
break;
case FUN:
break;
case ASG:
break;
case VAR:
break;
default:
printf("error: unknown command %s\n", s);
}
}
return 0;
}
int ptr = 0;
char line[MAXLINE];
void mgetline() {
int i, c;
for (i = 0; i < MAXLINE - 1 && (c = getchar()) != '\n' && c != EOF; i++) {
line[i] = c;
}
line[i] = 0;
}
|