Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random r = new Random();
- int goodCount = r.Next(4, 15);
- for (int i = 0; i < Console.WindowWidth * (Console.WindowHeight - 3); i++)
- {
- Console.Write('C');
- }
- int rectWidth = 10;
- int rectHeight = 10;
- int countRaw = Console.WindowWidth / rectWidth;
- for (int i = 0; i < goodCount; i++)
- {
- int rectLeftUpX = rectWidth * (i % goodCount);
- int rectLeftUpY = i / countRaw;
- int x = r.Next(rectLeftUpX, rectLeftUpX + rectWidth);
- int y = r.Next(rectLeftUpY, rectLeftUpY + rectHeight);
- Console.SetCursorPosition(x, y);
- Console.Write('S');
- }
- Console.SetCursorPosition(0, Console.WindowHeight -1);
- Console.WriteLine("Сколько 'C' Вы видите?");
- int answer = Convert.ToInt32(Console.ReadLine());
- if(answer == goodCount)
- {
- Console.WriteLine("Все верно, у Вас отличное зрение!");
- }
- else
- {
- Console.WriteLine("Увы, но Вы не угадали! Их - " + goodCount );
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement