これは、Visual C++ の Q&A ゲームの私のコードです
if (this->answer->Text == "2"){
this->question->Text = "2+2?";
}
else if (this->answer->Text == "4"){
this->question->Text = "3+3?";
}
else if (this->answer->Text == "6"){
this->question->Text = "4+4?";
}
else if (this->answer->Text == "8"){
this->question->Text = "Finished!";
}
else {
MessageBox::Show("Wrong!!");
}
このコードを短縮するものはありますか? 配列の使用を検討しますか?