Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Cube
- //Ivcho is a big computer genius. One day he was bored from all the girls that wanted to be with him and instead decided to wright //a computer game. Because he always likes to do things the hard way he decided to make a console game, but not any console game – //a 3D one! Just for the fun of it. But because he isn’t very good with graphics he needs your help with the basic building blocks //witch he can feed to his magic algorithm that produces HD 3D-reality in the console.
- //Your task is to wright a program that supplies him with cubes (basic building blocks). He will give you a number N and you should //print a cube with width = height = depth = N as shown in the examples. Mark the sides with “:” (colon).
- //In addition you will have to fill in some of the sides of the cube:
- //• The top should be filled in with “/” (slash)
- //• The side should be filled in with “X” (capital letter X)
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication5
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- string blank = new string(' ', n - 1);
- string dots = new string(':', n);
- Console.WriteLine("{0}{1}",blank,dots);
- for (int i = 0; i < n - 2; i++)
- {
- string slashes = new string ('/', n - 2);
- string blankk = new string (' ',2 * n - (n - 2) - i - 4);
- string xxx = new string('X',i);
- Console.WriteLine("{0}:{1}:{2}:",blankk,slashes,xxx);
- }
- string dotss = new string(':', n);
- string xx = new string('X', n - 2);
- Console.WriteLine("{0}{1}:",dotss,xx);
- for (int i = n - 3; i >= 0; i--)
- {
- string xxxx = new string ('X',i);
- string b = new string(' ', n - 2);
- Console.WriteLine(":{0}:{1}:",b,xxxx);
- }
- string d = new string(':', n);
- Console.WriteLine("{0}",d);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement