你好我想在Visual Studio 2013上使用Windows应用程序窗体做一个C++登录界面。问题是,我试图比较文本框中的值与文件中的行,但我出现操作数类型不兼容的错误。使用Windows应用程序的C++登录界面
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
string un, pw;
ifstream read("file.txt");
getline(read, un);
getline(read, pw);
if (textBox1->Text = un && textBox2->Text = pw){
MessageBox::Show("You have successfully login!", "Login Message", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
else {
MessageBox::Show("Incorrect Password or Username !", "Login Message", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
read.close();
}
如果你不擅长C++并且不想学习这门语言,为什么要在其中编写代码? – SergeyA
如果你有编译错误,你应该分享它们。发生错误是不好的。 – NathanOliver
@NathanOliver,想分享一下我的? :) – SergeyA