- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 62
- 63
- 64
- 65
void converting(char *in, char *out, node *PTR, char (checking_stack)(node), void (push)(node *topPTR, char value), int (pop)(node *fix), int (isOper)(char c), int (precedence_intro)(char data_1, char data_2, int(intro_precedence_power)(int res_1, int res_2)), int(intro_precedence_power)(int res_1, int res_2)) {
int k = 0, j = 0, d = 0;
push(PTR, '(');
for (k = 0; checking_stack((node)PTR) != 0; k++) {
if (isdigit(in[k])) {
out[j++] = in[k];
}
if (in[k] == '(') {
push(PTR, in[k]);
}
if (isOper(in[k]) == 1) {
while (precedence_intro((*PTR)->alpha, in[k], intro_precedence_power) != -1) {
out[j++] = pop(PTR);
}
push(PTR, in[k]);
}
if (in[k] == ')') {
d = pop(PTR);
for (; d != '('; d = pop(PTR)) {
out[j++] = d;
}
}
}
}
int precedence(char data_1, char data_2, int(intro_precedence_power)(int res_1, int res_2)) {
char collection[] = "+1-1*2/2^3";
char buf_1 = (char)strcspn( collection , &data_1) + 1;
char buf_2 = (char)strcspn(collection, &data_2) + 1;
return intro_precedence_power(atoi(&collection[buf_1]), atoi(&collection[buf_2]));
}
int precedence_power(int res_1, int res_2) {
if (res_1 < res_2) {
return -1;
}
else if (res_1 == res_2) {
return 0;
}
else if (res_1 > res_2) {
return 1;
}
return 0;
}
yet_another_one_shit 20.04.2019 12:50 # 0
PACTPOBblu_nemyx 20.04.2019 13:08 # 0
BOKCEJIbHblu_nemyx 20.04.2019 13:23 # 0
https://ideone.com/0FoZ6B
Какой анскилл )))
lazy_8 20.04.2019 15:00 # 0
1 3 7 + * 3 /, все становится более менее если эту приблуду buf_1 = (char)strcspn( collection , &data_1) + 1; заменить на 2 скучных Свитча, извините не читали мы "Драконов" )))
gost 20.04.2019 17:48 # 0
guest8 20.04.2019 15:50 # −999
BOKCEJIbHblu_nemyx 21.04.2019 07:34 # 0