0

I am making a quiz show in C++

I need help in storing the answers of a quiz in a array

like

cout<<"Q.1 Who is Known as the lady with lamp ?"<<endl<<endl;
cout<<"A. Sonia Gandhi "<<"B. Florence Nightngle"<<endl;
cout<<"C. Mother Tersa "<<"D. Madame Rozario"<<endl<<endl<<endl;

So how do I Input the answers in a array ??? gets ??? I also need to compare it from an array of correct answers.

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by ithelp
0

Perhaps a structure, say

struct question {
  std::string question;
  std::string answers[4];
  int correctAnswer;
};

Then later, you can say question quiz[10]; // 10 questions in this quiz Now see if you can write some code to
- initialise that array, say from a file
- print each question and possible answers in turn
- read a response from the user.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.