In the main function
The string variable mexp is defined as receiving an input expression,
A double-precision variable result is defined to save the calculation result.
Input calculation expression
Call the calculation function resultprocess.
In the calculation function, the formal parameter mexp (expression) results (save the calculation results).
A string variable signs is defined to store symbols.
A double-precision array variable shuzhi is defined to store numbers.
The variable sp, which is used to separate character strings, is defined.
Call the auxiliary processing function tokenprocess
In the auxiliary processing function, the formal parameter mexp (expression) shuzhi (save number) signs (save symbol).
Define a string temporary variable strtemp and a temporary character variable chartemp.
Define digital identification variable shuzhiflag, space identification variable spaceflag, decimal identification variable dotflag,
Define the separation times variable sp
The extracted numbers are stored in the number array shuzhi, and the extracted symbols are stored in the symbol array signs.
1 is returned in the correct format, and 0 is returned in the wrong format.
Go back to the calculation function and judge the return value of the auxiliary processing function.
Call the resultadd function ResultAdd in the correct format and return 1.
Format error returns 0
In the result addition function
According to the symbols in the symbol array.
Go back to the main function and judge the return value of the calculation function.
Return 1 output result
The output expression of arson 0 is malformed.