我尝试使用某些System :: Int32数据类型输入进行一些计算,但是当我尝试构建解决方案时,会发生错误。
这就是我想要做的。 (这是头文件的一部分,我想用它构建Windows窗体)
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Int32^ NumOneInt = Convert::ToInt32(NumOne);
Int32^ NumTwoInt = Convert::ToInt32(NumTwo);
Int32^ NumThreeInt = Convert::ToInt32(NumThree);
Int32^ NumFour = Convert::ToInt32(NumFour);
Int32^ maxvalue = 32;
Int32^ i = 0;
String^ newconstant;
Int32^ num = Convert::ToInt32(numstring);
class Calculations
{
public:
void calcs() {
for (incr = 0; incr < maxvalue; incr++) {
if (incr < numstring)
{
num += 1;
}
else
{
num += 2;
}
}
}
};
Calculations countit;
countit.calcs();
}
(我知道,我的代码完全是一团糟,我的语法也是如此。抱歉!)
Before using this code, I was trying to do calculations without class Calculations
and void calcs()
but I also failed.
Is it possible to calculate numbers with System::Int32 data type (or any data type similar to it)? Or should I convert it to std::int (if there's any possible way to do so)?
我在网上搜索了如此多的解决方案和文档,也阅读了一些书,但是却一无所获(或者我太笨拙而困惑,找不到它)。
我已经学习了C ++(标准)已经好几个月了,但是我对C ++ / CLI还是陌生的,所以我对C ++ / CLI的了解还不够(到目前为止)。任何建议或帮助都将得到认可,我们将不胜感激。非常感谢。