C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html

This commit is contained in:
Arash Partow 2017-11-05 03:03:31 +11:00
parent 4ba2236c4a
commit 149fa9879d
1 changed files with 21 additions and 29 deletions

View File

@ -1414,37 +1414,29 @@ The second variation of the if-statement is to allow for the use of
Else and If-Else cascading statements. Examples of such statements are Else and If-Else cascading statements. Examples of such statements are
as follows: as follows:
Example 1: Example 2: Example 1: Example 2: Example 3:
if (x < y) if (x < y) if (x < y) if (x < y) if (x > y + 1)
z := x + 3; { z := x + 3; { y := abs(x - z);
else y := z + x; else y := z + x; else
y := x - z; z := x + 3; y := x - z; z := x + 3; {
} } y := z + x;
else else z := x + 3;
y := x - z; y := x - z; };
Example 3: Example 4:
if (x > y + 1) if (2 * x < max(y,3))
y := abs(x - z); {
else y := z + x;
{ z := x + 3;
y := z + x; }
z := x + 3; else if (2y - z)
}; y := x - z;
Example 5: Example 6: Example 4: Example 5: Example 6:
if (x < y) if (x < y or (x + z) > y) if (2 * x < max(y,3)) if (x < y) if (x < y or (x + z) > y)
z := x + 3; { { z := x + 3; {
else if (2y != z) z := x + 3; y := z + x; else if (2y != z) z := x + 3;
{ y := x - z; z := x + 3; { y := x - z;
z := x + 3; } } z := x + 3; }
y := x - z; else if (abs(2y - z) >= 3) else if (2y - z) y := x - z; else if (abs(2y - z) >= 3)
} y := x - z; y := x - z; } y := x - z;
else else else else
x * x; { x * x; {
z := abs(x * x); z := abs(x * x);
x * y * z; x * y * z;
}; };
In the case where there is no final else statement and the flow In the case where there is no final else statement and the flow