repl.it
@justingraham/

Jeopardy English Project - Daniel X

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
//////////////////////////////////
///////////// Jeopardy ///////////
//// Dangerous Days of Daniel X //
////// Author: Justin Graham /////
//////////////////////////////////

#include <iostream>
#include <string>

using namespace std;


const int ROWS = 5;
const int COLUMNS = 5;
int board[ROWS][COLUMNS] =    { {100, 100, 100, 100, 100},
   								{200, 200, 200, 200, 200},
   								{300, 300, 300, 300, 300},   
   								{400, 400, 400, 400, 400},
   								{500, 500, 500, 500, 500} };
   								
string category;
    
int main()
{
	int dollars = 0;
	int team1 = 0;
	int team2 = 0;
    int turnnumber = 0;
    
//////////////////////////////////////////////////////////////////////////
////////////////////////////////Questions/////////////////////////////////
//////////////////////////////////////////////////////////////////////////

    string family1 = "\nThis is Daniel X's sister's nickname.\n>";
    string family2 = "\nHis name is Graff, sent to Earth to help humans in any way he could; one of Daniel X's main motivation to hunting alien #1.\n>";
    string family3 = "\nHer name is Atrelda, sent to Earth to help humans in any way she could.\n>";
    string family4 = "\nThis is the person who saves Daniel X's life when he is at Alpar Nok.\n>";
    string family5 = "\nDaniel's uncle that gave him the nickname ""Stinkyboy"".\n>";

    string friends1 = "\nThe one friend who doesn't shut up and is nonstop clowning around, making jokes.\n>";    
    string friends2 = "\nDaniel X says SHE is ""the most genuine person [he has] met. No ego, no big head, no agenda.""\n>";
    string friends3 = "\nEmma's older brother and is known for being the wingman for Daniel X.\n>";
    string friends4 = "\nThis friend is given the title ""Earth Mother"" and is Willy's younger sister.\n>";
    string friends5 = "\nThese are Daniel X's 4 friends (in alphabetical order).\n>";

    string issues1 = "\nThe alien that killed Daniel X's parents, is #1 on the list, and is Daniel X's ultimate objective alien to kill.\n";
    string issues2 = "\nHe is #6.\n>";
    string issues3 = "\nWhen Ergent Seth kidnaps Daniel X, he disables this most useful tool of Daniel X's.\n>";
    string issues4 = "\nHe plans to destroy all life on Earth and recolonize it with aliens from his own planet.\n>";
    string issues5 = "\nThis is what distracts Daniel X from his main goal (Phoebe is apart of this distraction) and stalls him.\n>";

    string events1 = "\nThis is what alien #1 was after when he went to Daniel X's house in the beginning of the book.\n>";
    string events2 = "\nTwo cops come to Daniel X's house and within the events, the cops tell Daniel X that he must participate in this.\n";
    string events3 = "\nAfter revealing himself, Ergent Seth disables Daniel X, shoots him, and drags him into this.\n>";
    string events4 = "\nThis was a plot twist; Ergent Seth's main disguise.\n>";
    string events5 = "\nErgent Seth's disguise when he demands Daniel X to get out of Los Angeles.\n>";

    string locations1 = "\nDaniel X's parents were killed here.\n>";
    string locations2 = "\nThis is where Daniel X travelled to and believed alien #6 was at.\n>";
    string locations3 = "\nDaniel X's and all of his friend's home planet.\n>";
    string locations4 = "\nThis is where Daniel X killed #19.\n>";
    string locations5 = "\nErgent Seth's planet of origin.\n>";

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

    // Categories: family, friends, issues, events, locations
    // 5 x 5 board
    //     Rows: Category
    //  Columns: Worth
    cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
    cout << "\n\t\tWelcome to the quiz of The Dangerous Days of Daniel X\n";
    cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
    cout << "NOTE: All answers are questions and begin with who, what, or where (ex: Where is Los Angeles?)";

	bool endofgame = false;

    while(endofgame != true)
    {
    	cin.clear();
		cout << "\n\nWinning: ";
		if(team1 > team2)
		{
			cout << "Team 1";
		}
		else if(team1 < team2)
		{
			cout << "Team 2";
		}
		else if(team1 == team2)
		{
			cout << "TIED";
		}

		cout << "\nTeam 1 has " << team1 << " Points.\n";
		cout << "Team 2 has " << team2 << " Points.\n\n";

		cout << "      Family    |    Friends\t|    Issues\t|     Events\t|  Locations\t|\n";
		cout << "------------------------------------------------------------------------------------\n";
		for (int row = 0; row < ROWS; ++row)
		{
			for (int col = 0; col < COLUMNS; ++col)
			{
			cout << "\t$" << board[row][col] << "\t|";
			}
			cout << endl;
			cout << "\n";
		}

		cout << "Category: ";
		getline(cin, category);
		while(category != "Family" & category != "Friends" & category != "Issues" & category != "Events" & category != "Locations" & category != "config" & category != "endofgame")
		{
			cout << "\n\nIncorrect name. Available: Family | Friends | Issues | Events | Locations";
			cout << "\nCategory:";
			getline(cin, category);
		}

   		if(category != "config" & category != "endofgame")
   		{
			cout << "\nAmount: ";
			cin  >> dollars;
   		}

   		if(category != "config" & category != "endofgame")
   		{
			while(dollars != 100 & dollars != 200 & dollars != 300 & dollars != 400 & dollars != 500)
			{
				cout << "\n\nIncorrect dollar amount. Amount:";
				cin >> dollars;
			}
   		}
		
		string answer;
		if(category == "Family")
		{
			if(dollars == 100)
			{
				board[0][0] = 0;
				string ansfamily1;
				cout << family1;
				cin.ignore();
				getline(cin, ansfamily1);
				if(ansfamily1 == "Who is Porkchop?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 200)
			{
				board[1][0] = 0;
				string ansfamily2;
				cout << family2;
				cin.ignore();
				getline(cin, ansfamily2);
				if(ansfamily2 == "Who is the father?") 
				{
					answer = "correct";
				}
			}
			else if(dollars == 300)
			{
				board[2][0] = 0;
				string ansfamily3;
				cout << family3;
				cin.ignore();
				getline(cin, ansfamily3);
				if(ansfamily3 == "Who is the mother?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 400)
			{
				board[3][0] = 0;
				string ansfamily4;
				cout << family4;
				cin.ignore();
				getline(cin, ansfamily4);
				if(ansfamily4 == "Who is his grandmother?")
					{
						answer = "correct";
					}
			}
			else if(dollars == 500)
			{
				board[4][0] = 0;
				string ansfamily5;
				cout << family5;
				cin.ignore();
				getline(cin, ansfamily5);
				if(ansfamily5 == "Who is Kraffleprog?")
				{
					answer = "correct";
				}
			}
		}
		else if(category == "Friends")
		{
			if(dollars == 100)
			{
				board[0][1] = 0;
				string ansfriends1;
				cout << friends1;
				cin.ignore();
				getline(cin, ansfriends1);
				if(ansfriends1 == "Who is Joe?") // friends first answer
				{
					answer = "correct";
				}
			}
			else if(dollars == 200)
			{
				board[1][1] = 0;
				string ansfriends2;
				cout << friends2;
				cin.ignore();
				getline(cin, ansfriends2);
				if(ansfriends2 == "Who is Dana?") // friends second answer
				{
					answer = "correct";
				}
			}
			else if(dollars == 300)
			{
				board[2][1] = 0;
				string ansfriends3;
				cout << friends3;
				cin.ignore();
				getline(cin, ansfriends3);
				if(ansfriends3 == "Who is Willy?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 400)
			{
				board[3][1] = 0;
				string ansfriends4;
				cout << friends4;
				cin.ignore();
				getline(cin, ansfriends4);
				if(ansfriends4 == "Who is Emma?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 500)
			{
				board[4][1] = 0;
				string ansfriends5;
				cout << friends5;
				cin.ignore();
				getline(cin, ansfriends5);
				if(ansfriends5 == "Who are Dana, Emma, Joe, and Willy?")
				{
					answer = "correct";
				}
			}
		}
		else if(category == "Issues")
		{
			if(dollars == 100)
			{
				board[0][2] = 0;
				string ansissues1;
				cout << issues1;
				cin.ignore();
				getline(cin, ansissues1);
				if(ansissues1 == "Who is The Prayer?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 200)
			{
				board[1][2] = 0;
				string ansissues2;
				cout << issues2;
				cin.ignore();
				getline(cin, ansissues2);
				if(ansissues2 == "Who is Ergent Seth?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 300)
			{
				board[2][2] = 0;
				string ansissues3;
				cout << issues3;
				cin.ignore();
				getline(cin, ansissues3);
				if(ansissues3 == "What is his powers?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 400)
			{
				board[3][2] = 0;
				string ansissues4;
				cout << issues4;
				cin.ignore();
				getline(cin, ansissues4);
				if(ansissues4 == "Who is Ergent Seth?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 500)
			{
				board[4][2] = 0;
				string ansissues5;
				cout << issues5;
				cin.ignore();
				getline(cin, ansissues5);
				if(ansissues5 == "What is high school?")
				{
					answer = "correct";
				}
			}
		}
		else if(category == "Events")
		{
			if(dollars == 100)
			{
				board[0][3] = 0;
				string ansevents1;
				cout << events1;
				cin.ignore();
				getline(cin, ansevents1);
				if(ansevents1 == "What is the List?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 200)
			{
				board[1][3] = 0;
				string ansevents2;
				cout << events2;
				cin.ignore();
				getline(cin, ansevents2);
				if(ansevents2 == "What is high school?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 300)
			{
				board[2][3] = 0;
				string ansevents3;
				cout << events3;
				cin.ignore();
				getline(cin, ansevents3);
				if(ansevents3 == "What is his spaceship?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 400)
			{
				board[3][3] = 0;
				string ansevents4;
				cout << events4;
				cin.ignore();
				getline(cin, ansevents4);
				if(ansevents4 == "Who is Phoebe Cook?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 500)
			{
				board[4][3] = 0;
				string ansevents5;
				cout << events5;
				cin.ignore();
				getline(cin, ansevents5);
				if(ansevents5 == "What is a cat?")
				{
					answer = "correct";
				}
			}
		}
		else if(category == "Locations")
		{
			if(dollars == 100)
			{
				board[0][4] = 0;
				string anslocations1;
				cout << locations1;
				cin.ignore();
				getline(cin, anslocations1);
				if(anslocations1 == "Where is his house?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 200)
			{
				board[1][4] = 0;
				string anslocations2;
				cout << locations2;
				cin.ignore();
				getline(cin, anslocations2);
				if(anslocations2 == "Where is Las Angeles?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 300)
			{
				board[2][4] = 0;
				string anslocations3;
				cout << locations3;
				cin.ignore();
				getline(cin, anslocations3);
				if(anslocations3 == "Where is Alpar Nok?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 400)
			{
				board[3][4] = 0;
				string anslocations4;
				cout << locations4;
				cin.ignore();
				getline(cin, anslocations4);
				if(anslocations4 == "Where is Portland?")
				{
					answer = "correct";
				}
			}
			else if(dollars == 500)
			{
				board[4][4] = 0;
				string anslocations5;
				cout << locations5;
				cin.ignore();
				getline(cin, anslocations5);
				if(anslocations5 == "Where is Gorto 4?")
				{
					answer = "correct";
				}
			}
		}
		else if(category == "config")
		{
			string addorsubtract;
			cout << "Add or subtract points?";
			cin  >> addorsubtract;

			while(addorsubtract != "add" & addorsubtract != "subtract")
			{
				cout << "\n\nIncorrect command:";
				cin  >> addorsubtract;
			}

			int teamselection;
			cout << "Which team?";
			cin  >> teamselection;

			while(teamselection != 1 & teamselection != 2)
			{
				cout << "\n\nIncorrect team:";
				cin  >> teamselection;
			}

			int amountofpoints;
			cout << "How many points?";
			cin  >> amountofpoints;

			if(addorsubtract == "add")
			{
				if(teamselection == 1)
				{
					team1 = team1 + amountofpoints;
				}
				if(teamselection == 2)
				{
					team2 = team2 + amountofpoints;
				}
			}
			else if(addorsubtract == "subtract")
			{
				if(teamselection == 1)
				{
				team1 = team1 - amountofpoints;
				}
				if(teamselection == 2)
				{
					team2 = team2 - amountofpoints;
				}
			}
		}
		else if(category == "endofgame")
		{
			endofgame = true;
		}
		 
		if(category != "config" & category != "endofgame")
		{
			if(answer == "correct" & turnnumber % 2 == 0)
			{
				team1 = team1 + dollars;
				turnnumber++;
				cout << "\nCorrect\n";
			}
			else if(answer == "correct" & turnnumber % 2 == 1)
			{
				team2 = team2 + dollars;
				turnnumber++;
				cout << "\nCorrect\n";
			}
			else
			{
				turnnumber++;
				cout << "\nIncorrect\n";
			}
		}
	}

	///////////////////////////////////////////////
	//////////////   End of Game   ////////////////
	///////////////////////////////////////////////
	
	int board[ROWS][COLUMNS] = { {0, 0, 0, 0, 0},
   								 {0, 0, 0, 0, 0},
   								 {0, 0, 0, 0, 0},   
   								 {0, 0, 0, 0, 0},
   								 {0, 0, 0, 0, 0} };
   								 
	cout << "\n      Family    |    Friends\t|    Issues\t|     Events\t|  Locations\t|\n";
	cout << "------------------------------------------------------------------------------------\n";
	for (int row = 0; row < ROWS; ++row)
	{
		for (int col = 0; col < COLUMNS; ++col)
		{
		cout << "\t$" << board[row][col] << "\t|";
		}
		cout << endl;
		cout << "\n";
	}
	
	// Depicts the winner
	
	cout << "\nWinner: ";
	if(team1 > team2)
	{
		cout << "Team 1";
	}
	else if(team1 < team2)
	{
		cout << "Team 2";
	}
	else if(team1 == team2)
	{
		cout << "TIED";
	}
	
	cout << "\nTeam 1 ends with " << team1 << " Points.\n";
	cout << "Team 2 ends with " << team2 << " Points.\n\n";
	
    return 0;
}


/* 
Q: This is Daniel X's sister's nickname.
A: Who is Porkchop?

Q: His name is Graff, sent to Earth to help humans in any way he could; one of Daniel X's main motivation to kill alien #1.
A: Who is the father?

Q: Her name is Atrelda, sent to Earth to help humans in any way she could.
A: Who is the mother?

Q: This is the person who saves Daniel X's life when he got to Alpar Nok.
A: Who is his grandmother?

Q: Daniel's uncle that gave him the nickname "Stinkyboy".
A: Who is Kraffleprog?



Q: The one friend who doesn't shut up and is nonstop clowning around, making jokes.
A: Who is Joe?

Q: Daniel X says SHE is "the most genuine person [he has] met. No ego, no big head, no agenda.
A: Who is Dana?

Q: Emma's older brother and is known for being the wingman for Daniel X.
A: Who is Willy?

Q: This friend is given the title "Earth Mother" and is Willy's younger sister.
A: Who is Emma?

Q: These are Daniel X's 4 friends (in alphabetical order).
A: Who are Dana, Emma, Joe, and Willy?



Q: The alien that killed Daniel X's parents, is #1 on the list, and is Daniel X's ultimate objective alien to kill.
A: Who is The Prayer? 

Q: He is #6
A: Who is Ergent Seth?

Q: When Ergent Seth kidnaps Daniel X, he disables this most useful tool of Daniel X's.
A: What is his powers?

Q: He plans to destroy all life on Earth and recolonize it with aliens from his own planet.
A: Who is Ergent Seth?

Q: This is what distracts him from his main goal (Phoebe is apart of it).
A: What is high school?



Q: This is what alien #1 was after when he went to Daniel X's house in the beginning of the book. 
A: What is the List? 

Q: Two cops come to Daniel X's house and within the events, the cops tell Daniel X that he must participate in this.
A: What is high school?

Q: After revealing himself, Ergent Seth disables Daniel's powers, shoots him, and drags him into this.
A: What is his spaceship?

Q: This was a plot twist; Ergent Seth's main disguise
A: Who is Phoebe Cook?

Q: Ergent Seth's disguise when he demands Daniel X to get out of Los Angeles. 
A: What is a cat?



Q: Daniel X's parents were killed here.
A: Where is his house?

Q: This is where Daniel X travelled to and believed alien #6 was at.
A: Where is Las Angeles?

Q: Daniel X's and all of his friend's home planet
A: Where is Alpar Nok?

Q: This is where Daniel X killed #19
A: Where is Portland?

Q: Ergent Seth's planet of origin.
A: Where is Forto 4?
*/
Fetching token
?