-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuestion.cs
44 lines (40 loc) · 1.41 KB
/
Question.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kck1
{
class Question
{
public string Content { get; }
public string OptionA { get; }
public string OptionB { get; }
public string OptionC { get; }
public string OptionD { get; }
public char CorrectAnswer { get; }
public int QuestionIndex { get; }
public Question(int QuestionIndex, string[] Questions)
{
Content = Questions[QuestionIndex];
OptionA = Questions[QuestionIndex + 1];
OptionB = Questions[QuestionIndex + 2];
OptionC = Questions[QuestionIndex + 3];
OptionD = Questions[QuestionIndex + 4];
this.QuestionIndex = QuestionIndex / 7;
CorrectAnswer = Questions[QuestionIndex + 5][0];
}
public override string ToString()
{
return Content + " " + OptionA + ' ' + OptionB + ' ' + OptionC + ' ' + OptionD + ' ' + CorrectAnswer + ' ' + QuestionIndex;
}
static Question PickRandomQuestion(ref List<Question> Questions)
{
var Rand = new Random();
var RandIndex = Rand.Next(0, Questions.Count / 7) * 7;
var PickedQuestion = Questions.ElementAt(RandIndex);
Questions.RemoveAt(RandIndex);
return PickedQuestion;
}
}
}