Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Non-User input - Random Controlled - Guessing Game
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Net.Sockets; namespace Rextester { public class Program { public static void Main(string[] args) { Random rand = new Random(); Console.WriteLine("Number Guessing Game"); Console.WriteLine("---------------------"); Console.WriteLine(""); bool correct = false; int input = rand.Next(1,20); int life = 10; while(!correct) { int Rand = rand.Next(1,20); if(input == Rand) { correct = true; Console.WriteLine("{0} is Correct",Rand); } if(life == 0) { Console.WriteLine("Too many attempts"); break; } if(input > Rand) { Console.WriteLine("{0} is Too Low - ({1})",Rand, input); life--; } if(input < Rand) { Console.WriteLine("{0} is Too High - ({1})",Rand,input); life--; } } } } }
run
|
edit
|
history
|
help
0
dfrgthyjujyhtgrf
C# practice
file Info and File Stream
Static 2
concrete class with inheritance
enum.TryParse
Find the sum of squares for prime numbers of the form (4k + 1).
Lazy XML selection
English stop words
Hash plus i minus