10 c algorithm parsing data-structures
(在c90中)(linux)
输入:
sqrt(2 - sin(3*A/B)^2.5) + 0.5*(C*~(D) + 3.11 +B)
a
b /*there are values for a,b,c,d */
c
d
Run Code Online (Sandbox Code Playgroud)
输入:
cos(2 - asin(3*A/B)^2.5) +cos(0.5*(C*~(D)) + 3.11 +B)
a
b /*there are values for a,b,c,d */
c
d
Run Code Online (Sandbox Code Playgroud)
输入:
sqrt(2 - sin(3*A/B)^2.5)/(0.5*(C*~(D)) + sin(3.11) +ln(B))
/*max lenght of formula is 250 characters*/
a
b /*there are values for a,b,c,d */
c /*each variable with set of floating numbers*/
d
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,输入中的中缀公式取决于用户.我的程序将采用公式和n元组值.然后计算a,b,c和d的每个值的结果.如果你想知道我在说;程序的结果是图表./ 有时候,我想我会把输入和存储在字符串中.然后出现另一个想法"我应该在结构中存储公式"但是?不知道如何在结构的基础上构建代码./
真的,我不知道如何在程序代码中存储公式,以便我可以完成我的工作.能给我看看么?
/* a,b,c,d is letters
cos,sin,sqrt,ln is function*/
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2945 次 |
最近记录: |