QandA程序循环A如果回答错误

时间:2015-10-08 08:02:39

标签: java joptionpane

我目前正在建立一个问答程序。但我坚持,因为我想重复这个问题(如果用户仍然希望继续回答问题,直到她/他退出游戏,则无限制。)你不能移动到下一个,直到回答正确。请帮帮我=。=

echo stripslashes($str);

}

1 个答案:

答案 0 :(得分:0)

这是一种伪代码,您可以将其更改为java代码:

for(Question question: questions){
    Answer answer = askQuestion(Question)

    if(question.answer = answer)
        showInfo("you are correct, next question will be " + question.num + 1)
    else{
        response = showInfo("you are wrong. do you want to try?")

        if(response = no)
            break;
    }

}
Answer askQuestion(Question question){

    return showQuestion(question);

}