-
Notifications
You must be signed in to change notification settings - Fork 0
/
Questions.cs
85 lines (72 loc) · 2.24 KB
/
Questions.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//------------------------------------------------------------------------------
// Name: LEO-Irabor Joshua
// Title: Who want's to be a Millionaire Game Model
// Date Started: 27th December 2013
// Date Finished: 29th December 2013
//
// Updates:
// 30th December 2013 --> Added the "Walk away" option.
//
//
//------------------------------------------------------------------------------
using System;
using System.IO;
using System.Diagnostics;
namespace WWTBAM
{
class Questions
{
int[] number;
int presentQuestion;
public Questions()
{
Random questionNumber = new Random();
number = new int[10];
for (int i = 0; i < 10; i++)
{
if( i < 5 )
{
number[i] = questionNumber.Next(1 , 11);
}
else if(i > 5 && i < 8)
{
number[i] = questionNumber.Next(10 , 21);
}
else
{
number[i] = questionNumber.Next(20 , 31);
}
}
this.presentQuestion = 0;
}
public int PresentQuestion
{
get { return this.presentQuestion;}
set { this.presentQuestion = value;}
}
public string[] GetQuestion
{
get
{
StreamReader inStream = new StreamReader("GameQuestions.csv");
int loop = 0;
string line = "";
string[] data = null;
while(!inStream.EndOfStream && loop < this.number[this.presentQuestion])
{
line = inStream.ReadLine();
loop++;
}
data = line.Split('>', '#');
inStream.Close();
return data;
}
}
public override string ToString()
{
string[] values = this.GetQuestion;
string output = string.Format("{0}\n{1}", values[0], values[1]);
return output;
}
}
}