Домашно Тема 2/Задача 17
Здравейте, може ли малко помощ за задача 17 от второто домашно? Условието е:
"Do you know that the next solar eclipse will occur on April 29, 2014? It will be observable from South Asia, Australia, the Pacific and the Indian Oceans and Antarctica. Spiro is an entrepreneur who wants to cash in on this natural phenomenon. Help him produce protective sunglasses of different sizes. You will get 5% of the profit.
Input
The input data should be read from the console.
You have an integer number N (always an odd number) specifying the height of sunglasses.
The input data will always be valid and in the format described. There is no need to check it explicitly.
The output should be printed on the console.
You should print the sunglasses on the console. The sunglasses consist of three parts: frames, lenses and a bridge (the connection between the two frames). Each frame's width is double the height N and should be printed using the character '*' (asterisk). Print the lenses with the character '/'. Finally, connect the two frames with a bridge that is of size N, using the character '|'. Leave the rest of the space between the frames blank."
Това, което успях да измсиля е
-
using System;
-
-
class Sunglasses
-
{
-
public static void Main()
-
{
-
int height = int.Parse(Console.ReadLine());
-
int width = 2 * height;
-
string upperPart = new string('*', width);
-
string bridge = new string('|', height);
-
string bridgeSpace = new string(' ', height);
-
int middleOfTheHeight = (height / 2) + 1;
-
-
if (height%2 != 0)
-
{
-
Console.WriteLine(upperPart + bridgeSpace + upperPart);
-
for (int line = 3; line <= height; line++)
-
{
-
string lens = new string('/', width-2);
-
Console.WriteLine("*" + lens + "*" + bridgeSpace + "*" + lens + "*");
-
}
-
-
string lowerPart = upperPart;
-
Console.WriteLine(lowerPart + bridgeSpace + lowerPart);
-
}
-
}
-
}
По какъв начин мога да изпринтя "мостът", който се съсоти от "|" между двете лещи?
Пуснал съм темата в раздел C# Basics :) Иначе, извинявам се, вече ще питам в обща тема, ако има таква