admin管理员组文章数量:1123010
i tried to utilise the root symbol in my windows form calculator using a combobox. excuse me for the messy code.
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
float x, y, z;
bool err = false;
x = int::Parse(textBox1->Text);
y = int::Parse(textBox3->Text);
if (comboBox1->SelectedItem->ToString() == "+") z = x + y;
else if (comboBox1->SelectedItem->ToString() == "-") z = x - y;
else if (comboBox1->SelectedItem->ToString() == "/") z = x / y;
else if (comboBox1->SelectedItem->ToString() == "*") z = x * y;
else if (comboBox1->SelectedItem->ToString() == "^") z = pow(x, y);
else if (comboBox1->SelectedItem->ToString() == "√") z = sqrt(x);
// if (comboBox1->SelectedItem->ToString() == "/" && y == 0) err = true;
if (err == true) textBox4->Text = "error";
else textBox4->Text = z.ToString();
}
i simply used the unicode symbol in both the code and the combobox items list. it should've passed the if statement and simply squared x and given z, however the program just does not calculate anything (which by my guess, it doesn't pass the if statement because if i replace square root symbol with a regular char it works perfectly)
本文标签: comboboxis there any possibility of utilising unicode characters in c codeStack Overflow
版权声明:本文标题:combobox - is there any possibility of utilising unicode characters in c++ code? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736540861a1944385.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论