Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num, r, c, H = 0;
- char ds;
- Random rnd = new Random();
- do
- {
- Console.WriteLine("Scrivi un numero compreso tra 1 e 20");
- num = Convert.ToInt16(Console.ReadLine());
- }
- while (num > 20 | num < 0);
- for (r = 1; r <= num; r++) //incremento
- {
- for (c = num + 1 - (r + 1); c >= 0; c--)
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- Console.Write("-");
- }
- for (c = 1; c <= r; c++)
- {
- H = rnd.Next(1, 10);
- if (H < 2)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- ds = '*';
- }
- else if (H < 9)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- ds = 'o';
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Yellow;
- ds = 'x';
- }
- Console.Write(ds);
- }
- for (c = 1; c < r; c++)
- {
- H = rnd.Next(1, 10);
- if (H < 2)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- ds = '*';
- }
- else if (H < 9)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- ds = 'o';
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Yellow;
- ds = 'x';
- }
- Console.Write(ds);
- }
- for (c = num + 1 - (r + 1); c >= 0; c--)
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- Console.Write("-");
- }
- Console.WriteLine();
- }
- for (int t = 1; t <= (num / 4); t++) //tronco
- {
- for (c = num + 1 - (r + 1); c > 0; c--)
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- Console.Write("-");
- }
- for (r = 1; r < num; r++)
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- Console.Write("-");
- }
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- Console.Write("888");
- for (r = 1; r < num; r++)
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- Console.Write("-");
- }
- Console.WriteLine();
- }
- Console.ReadLine();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement