It is necessary to break the incoming string into substrings for further recognition. For example А1+В2+С3
. It is required to break from and to +. That is, it should be А1,В2,С3
. Code:
Find signs and write to the array position where these characters are found.
for(i = 0; i<=str.Length(); i++) { if (str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/' ) { pos[j] = i; k = j; j++; } }
Next, break into substrings.
for (j = 0; j<=k; j++) for (i = 0; i<=pos[j]; i++) a = a + str[i];
All that, but gives error RangeCheck Error
. During the test, it turned out that he does not want to take str[1]
(1, 2, 3 is not important - an error with this form of calculation is always). str
type String
read from Edit1
.