【发布时间】:2016-07-31 02:26:08
【问题描述】:
我有一个名为 QuestionsAll 的类,带有构造函数:
QuestionsAll(label question, Button b1, Button b2, Button b3, Button b4)
和调用的方法:
questions(string question, string answer1, string answer2, string answer3, string answer4, Button correctanswer)
我如何在我的表单中使用它:
void NewQuestion()
{
Random rd = new Random();
int qu = rd.Next(0,4)
QuestionsAll q = new QuestionsAll(label1,Button1,Button2,Button3,Button4) //my question will be in label1, answer1 in Button1......)
if(qu == 1) q.questions("1+1 =", "1", "2", "3", "4", Button2);
if(qu == 2) q.questions("1+2 =", "1", "2", "3", "4", Button3);
}
当您点击正确的问题时,问题会发生变化,但问题和答案会重复。我怎样才能做到不重复?
【问题讨论】:
-
您需要包含有关当前行为和您期望的行为的更多信息。
标签: c# list class if-statement methods