你好我想在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