使用Tallies生成测验

时间:2018-02-15 05:38:18

标签: c++

我完成了测验的编码,想知道是否有人可以帮助我使程序记录有多少被正确回答,有多少被错误地回答。

#include <iostream>
using namespace std;

char askQuestion (int questionNumber, char* question, char* optionA, char* optionB, char* optionC) {
    char answer;
    cout << questionNumber << ".)" << question << "\n";
    cout << optionA << "\n";
    cout << optionB << "\n";
    cout << optionC << "\n";
    cin >> answer;
    return answer;
}
int main()
{
    char answer1;
    char answer2;
    char answer3;
    char answer4;
    char answer5;
    char questionNumber;

    questionNumber = 1;
    answer1 = askQuestion(questionNumber, "Who is the Big Red Dog?", "A.)Milo", "B.)Clifford", "C.)Jack");

    questionNumber = 2;
    answer2 = askQuestion(questionNumber, "What kind of dog was Air Bud?", "A.)German Shepard", "B.)Pomski", "C.)Golden Retriever");

    questionNumber = 3;
    answer3 = askQuestion(questionNumber, "Who is the Cowardly Dog?", "A.)Rex", "B.)Jeff", "C.)Courage");

    questionNumber = 4;
    answer4 = askQuestion(questionNumber, "Whats the name of the Grinch's dog?", "A.)Max", "B.)Spike", "C.)Fido");

    questionNumber = 5;
    answer5 = askQuestion(questionNumber, "Who is the Griffen's dog from Family Guy?", "A.)Glen", "B.)Joe", "C.)Brian");

}

0 个答案:

没有答案