D
Deleted member 613
Guest
C#:
using System;
class MainClass {
public static void Main (string[] args) {
//Defuse the bomb!
Console.WriteLine("Choose the correct wire to defuse the bomb!");
string[] theanswer = { "A", "B", "C", "D" };
Random Rng = new Random();
//Creating the wire that defuses the bomb
int answer2 = Rng.Next(0, 4);
int answer3;
//Creating the four 'wires' and colouring them.
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("|---|");
Console.WriteLine("|-1-|");
Console.WriteLine("|---|");
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("|---|");
Console.WriteLine("|-2-|");
Console.WriteLine("|---|");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("|---|");
Console.WriteLine("|-3-|");
Console.WriteLine("|---|");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("|---|");
Console.WriteLine("|-4-|");
Console.WriteLine("|---|");
Console.ForegroundColor = ConsoleColor.White;
answer3 = int.Parse(Console.ReadLine());
if (answer2 == answer3 //If the Users answer equals the correct answer then:)
{
Console.WriteLine("Congrats, you have defused the bomb!");
}
else //Otherwise this code segment is run:
{
Console.WriteLine("You could not defuse the bomb in time!");
}
Console.ReadLine();
}
}
Last edited by a moderator: