dimanche 12 février 2017

C# - Why does it set to magenta every time?

Vote count: 0

I'm trying to set the console background color to a random color but it always returns magenta.

using System;

namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Random random = new Random(); int randomInt = random.Next(0, 6); while(randomInt < 7) { Console.BackgroundColor = ConsoleColor.Red; randomInt++; Console.BackgroundColor = ConsoleColor.Blue; randomInt++; Console.BackgroundColor = ConsoleColor.Cyan; randomInt++; Console.BackgroundColor = ConsoleColor.Green; randomInt++; Console.BackgroundColor = ConsoleColor.Red; randomInt++; Console.BackgroundColor = ConsoleColor.Yellow; randomInt++; Console.BackgroundColor = ConsoleColor.Magenta; randomInt++; } } } }

asked 17 secs ago

Let's block ads! (Why?)



C# - Why does it set to magenta every time?

Aucun commentaire:

Enregistrer un commentaire