-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
149 lines (130 loc) · 5.47 KB
/
Program.cs
File metadata and controls
149 lines (130 loc) · 5.47 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using System.Runtime.InteropServices;
using System;
using System.Security.Cryptography;
using System.Xml.Linq;
namespace random_joke
{
internal class Program
{
static void Main(string[] args)
{
// defineing jokes
string[] jokes = new string[]
{
"Where are average things manufactured?",
"Why do we tell actors to “break a leg?”",
"Hear about the new restaurant called Karma?",
"Did you hear about the actor who fell through the floorboards?",
"Did you hear about the claustrophobic astronaut?",
"Why don’t scientists trust atoms?",
"What’s the best thing about Switzerland?",
"What sits at the bottom of the sea and twitches?",
"How does Moses make tea?",
"What kind of exercise do lazy people do?",
"A pair of cows were talking in the field. One says,\n“Have you heard about the mad cow disease that’s going around?”",
"I told my wife she was dawing her eyebrows too high,"
};
// defineing awnsers
string[] ansr = new string[]
{
"The satisfactory.",
"Because every play has a cast.",
"There’s no menu: You get what you deserve.",
"He was just going through a stage.",
"He just needed a little space.",
"Because they make up everything.",
"I don’t know, but the flag is a big plus.",
"A nervous wreck.",
"He brews.",
"Diddly-squats.",
"“Yeah,” the other cow says.\n“Makes me glad I’m a penguin.”",
"She looked suprised"
};
// funny popups
string[] funnymsgs = new string[]
{
"How much time do you have?",
"P.S. Go touch grass.",
"WHY ARE YOU STILL HERE?"
};
int msg = 0;
int count = 0;
int i = 0;
int counter = 1;
int[] usedjokes = new int[jokes.Length];
int insult = 1;
bool roast = false;
// main loop
while (true)
{
// defineing the new group of random ints
Random rnd = new Random();
// changing a to another after the first loop
string anothera = "a";
if (count >= 1)
anothera = "another";
if (roast == true)
{
Console.WriteLine($"{funnymsgs[msg]}\n");
msg++;
roast = false;
}
Console.WriteLine($"Would you like to hear {anothera} joke? Y/N:");
count++;
string yorn = Console.ReadLine();
Console.Clear();
if (insult == 5 && msg + 1 <= funnymsgs.Length) // checks if there is any text to display
{
roast= true;
insult = 1;
}
insult++;
// generates a random number != any previous numbers
int testcount = 0;
while (true)
{
if (i == usedjokes[testcount])
{
i = rnd.Next(0, jokes.Length); //returns random integers >= 0 and < 11
testcount = 0;
}
else
{
testcount++;
}
if (testcount == usedjokes.Length - 1)
{
usedjokes[counter - 1] = i;
break;
}
}
// checks if user input is equal to yes
if (String.Equals("y", yorn) || String.Equals("Y", yorn))
{
Console.WriteLine($"{jokes[i]}");
Console.WriteLine("\n\nPRESS ANY KEY TO CONTINUE");
Console.ReadKey();
Console.Clear();
Console.WriteLine($"\n\n{ansr[i]}");
Console.WriteLine("\n\nPRESS ANY KEY TO CONTINUE");
Console.ReadKey();
Console.Clear();
counter++;
}
else if (String.Equals("n", yorn) || String.Equals("N", yorn)) // checks if user input is equal to no
{
Console.WriteLine("you're no fun...");
Console.WriteLine(":(");
Console.WriteLine("\n\nPRESS ANY KEY TO EXIT\n\n\n\n\n\n\n");
break;
}
if (counter > jokes.Length) // ends program if it rus out of jokes
{
Console.WriteLine($"Sorry, we are out of jokes. \n\nYou fliped through all {jokes.Length} of our jokes.\n\n\nPRESS ANY KEY TO EXIT\n\n\n\n\n\n");
Console.ReadKey();
break;
}
}
}
}
}