必须将字符串转换为 double 吗?如果是这样。怎么办?
是否有 trig 函数可以按原样接受文本框字符串数据?
有没有办法将文本框中的数据作为数值而不是字符串提取?
最佳答案
must you convert from strings to double? if so. how?
是的。 There are quite a few ways to do this.
Are there functions for trig that will accept textbox string data as is?
不,但是如果您真的想要一个,您可以使用上述问题中描述的技术之一轻松实现这样的功能。
通常您希望在使用之前验证用户输入以确保它是正确的,并且验证数字形式的输入比验证原始字符串容易得多。
Is there a way to pull the data from the textbox as a numeric value, not as a string?
也许;这完全取决于您使用的 GUI 框架。
关于c++ - 如何对 Windows 文本框中的数据执行三角函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2962085/