在运行时调用数学函数

编程入门 行业动态 更新时间:2024-10-28 18:28:34
本文介绍了在运行时调用数学函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不知道怎么问这个,所以有人不会误读它但是这里 去了。 在运行时我想要能够评估数学库中的函数, 但是在设计时我不知道需要什么函数。 我知道我能做到 如果Userinput =" SINE"然后zz = Sin(无论如何) 但我想做的是zz = MyMappingToMath(用户输入) 例如 假设用户在运行时输入SINE(30) 如果我没有特别的 条款,我有什么方法可以得到SINE(30)的值在设计时为SINE设计? 谢谢

解决方案

如果我理解正确的话, 你可以: 1.创建定义你的 语法的函数和/或运算符重载, 2让用户提供代码并动态编译到内存中, 我的意思是Activator.CreateInstance等等 (这需要一些很少熟悉反思,CodeDOM, 代表...) www.thescripts/forum/thread348196.html .... Franky ha scritto: 我不知道怎么问这个,所以有人不会误读它但是这里 去了。 在运行时,我希望能够从数学库中评估函数, 但在设计时我不知道需要什么函数。 我知道我可以做 如果Userinput =" SINE"然后zz = Sin(无论如何) 但我想做的是zz = MyMappingToMath(用户输入) 例如 假设用户在运行时输入SINE(30) 如果我没有特别的 条款,我有什么方法可以得到SINE(30)的值在设计时为SINE设计? 谢谢

Franky, 实际上没有,但你可以使用脚本(VBS)我认为那些功能 在那些地方。 www.vb-tips/dbpages.aspx?。 ..1-2b03e1a439ae 我希望这能给出一些想法/ s Cor "永邦" < fr ********** @ a-znetschreef in bericht 新闻:OZ ************** @ TK2MSFTNGP04.phx .gbl ...

>我不知道如何问这个问题,以致有人不会误读它,但是这里去了。 /> 在运行时,我希望能够从Math 库中评估函数,但在设计时我不知道需要哪些函数。 /> 我知道我可以做 如果Userinput =" SINE"然后zz = Sin(无论如何) 但我想做的是zz = MyMappingToMath(用户输入) 例如 假设用户在运行时输入SINE(30) 如果我没有特别的 条款,我有什么方法可以得到SINE(30)的值在设计时为SINE设计? 谢谢

谢谢,我用过但现在我我想知道我是否真的可以解释一个 小型基础课程 谢谢,就是我需要的东西 " Cor Ligthert [MVP]" < no ************ @ planet.nlwrote in message news:uJ ************** @ TK2MSFTNGP03.phx .gbl ...

Franky, 其实没有,但你可以使用脚本(VBS)我认为那些 的功能在哪里。 www.vb-tips/dbpages.aspx?...1-2b03e1a439ae 我希望这能给出一些想法/ s Cor "永邦" < fr ********** @ a-znetschreef in bericht 新闻:OZ ************** @ TK2MSFTNGP04.phx .gbl ...

>>我不知道如何问这个问题,以致有人不会误读它,但这里去了。 在运行时我希望能够从Math 库中评估函数,但在设计时我不知道需要哪些函数。 我知道我能做到 如果Userinput =SINE然后zz = Sin(无论如何) 但我想做的是zz = MyMappingToMath(userinput) 例如假设用户输入SINE(30)at运行时间如果我在设计时没有为SINE做出特殊的规定,有什么办法可以获得SINE(30)的价值吗? 谢谢

I don''t know how to ask this so that someone will not misread it but here goes. At run time I want to be able to evaluate functions from the Math library, but at design time I do not know what functions will be needed. I know I can do If Userinput = "SINE" Then zz = Sin(whatever) but what I want to do is zz= MyMappingToMath(userinput) e.g Suppose the user inputs SINE(30) at run time Is there some way I can get the value of SINE(30) if I made no special provisions for SINE at design time? Thanks

解决方案

If I understand you correctly, you could: 1. Create functions and/or operator overloads that define your syntax, 2. Let the user provide the code and compile it to memory on the fly, I mean the Activator.CreateInstance stuff and so on (this requires some little familiarity with reflection, CodeDOM, delegates ... ) www.thescripts/forum/thread348196.html .... Franky ha scritto:

I don''t know how to ask this so that someone will not misread it but here goes. At run time I want to be able to evaluate functions from the Math library, but at design time I do not know what functions will be needed. I know I can do If Userinput = "SINE" Then zz = Sin(whatever) but what I want to do is zz= MyMappingToMath(userinput) e.g Suppose the user inputs SINE(30) at run time Is there some way I can get the value of SINE(30) if I made no special provisions for SINE at design time? Thanks

Franky, In fact not, but you can use scripting (VBS) I thought that those functions where in those. www.vb-tips/dbpages.aspx?...1-2b03e1a439ae I hope this gives some idea/s Cor " Franky" <fr**********@a-znetschreef in bericht news:OZ**************@TK2MSFTNGP04.phx.gbl...

>I don''t know how to ask this so that someone will not misread it but heregoes. At run time I want to be able to evaluate functions from the Math library, but at design time I do not know what functions will be needed. I know I can do If Userinput = "SINE" Then zz = Sin(whatever) but what I want to do is zz= MyMappingToMath(userinput) e.g Suppose the user inputs SINE(30) at run time Is there some way I can get the value of SINE(30) if I made no special provisions for SINE at design time? Thanks

Thanks, I used that but now I''m wondering if I can actually interpret a small Basic program Thanks, just what I needed "Cor Ligthert [MVP]" <no************@planet.nlwrote in message news:uJ**************@TK2MSFTNGP03.phx.gbl...

Franky, In fact not, but you can use scripting (VBS) I thought that those functions where in those. www.vb-tips/dbpages.aspx?...1-2b03e1a439ae I hope this gives some idea/s Cor " Franky" <fr**********@a-znetschreef in bericht news:OZ**************@TK2MSFTNGP04.phx.gbl...

>>I don''t know how to ask this so that someone will not misread it but heregoes.At run time I want to be able to evaluate functions from the Mathlibrary, but at design time I do not know what functions will be needed.I know I can doIf Userinput = "SINE" Then zz = Sin(whatever)but what I want to do is zz= MyMappingToMath(userinput)e.gSuppose the user inputs SINE(30) at run timeIs there some way I can get the value of SINE(30) if I made no specialprovisions for SINE at design time?Thanks

更多推荐

在运行时调用数学函数

本文发布于:2023-11-05 06:28:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560156.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时调   函数   数学

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!