Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int scale = int.Parse(Console.ReadLine());
- int totalHeight = scale * 2 - 1;
- int firstHeight = scale;
- int midHeight = scale / 2;
- int lastStart = firstHeight + midHeight;
- // Here follow the variables for the Upper part
- char backgroundHyphen = '-';
- int bckgrndHyphenStartNum = 3 * scale;
- char axeSymbol = '*';
- int axeUpperNum = 1;
- char innerSymbol = '-';
- int innerUpperNum = 0;
- int bckgrndHyphenEndNum = scale * 2 - 2;
- // Here follow the variables for the middle part
- char handleSymbol = '*';
- int handleSymbolNum = 3 * scale;
- int axeMidNum = 1;
- char inner = '-';
- int innerMidNum = scale - 1;
- // And here are the variables for the last/lower part
- int backgroundLowerNum = scale * 3;
- int axeLowerNum = 1;
- int innerLowerNum = scale - 1;
- char endSymbol = '-';
- int endNum = scale - 1;
- // Here starts the drawing.
- for (int i = 1; i <= totalHeight; i++)
- {
- if(i <= firstHeight) // draw upper
- {
- Console.WriteLine("{0}{1}{2}{1}{3}", new string(backgroundHyphen, bckgrndHyphenStartNum), new string(axeSymbol, axeUpperNum), new string(innerSymbol, innerUpperNum), new string(endSymbol, bckgrndHyphenEndNum));
- innerUpperNum++;
- bckgrndHyphenEndNum--;
- }
- else if(i >= lastStart) // draw last part
- {
- if (i < totalHeight)
- {
- Console.WriteLine("{0}{1}{2}{1}{3}", new string(backgroundHyphen, backgroundLowerNum), new string(axeSymbol, axeLowerNum), new string(inner, innerLowerNum), new string(endSymbol, endNum));
- backgroundLowerNum--;
- innerLowerNum += 2;
- endNum--;
- }
- else
- {
- int width = scale * 5;
- int axeSymbolNum = (width - ((backgroundLowerNum - 1) + endNum)) - 1;
- Console.WriteLine("{0}{1}{2}", new string(backgroundHyphen, backgroundLowerNum), new string(axeSymbol, axeSymbolNum), new string(endSymbol, endNum));
- }
- }
- else // draw handle
- {
- Console.WriteLine("{0}{1}{2}{1}{2}", new string(handleSymbol, handleSymbolNum), new string(axeSymbol, axeMidNum), new string(inner, innerMidNum));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement