using System;
using System.Threading;
using System.Reflection.Metadata;
namespace StarSquare
{
internal class Program
{
static void Main()
{
const int consoleWidth = 80;
const int consoleHeight = 30;
Console.SetWindowSize(consoleWidth, consoleHeight);
string userInput;
int userInteger;
Console.Write("\n Starsquare " +
"\n============================================" +
"\n Welche Seitenlänge soll das Quadrat haben? " +
"\n ");
userInput = Console.ReadLine();
int.TryParse(userInput, out userInteger);
for (int i = 0; i < userInteger; i++)
{
for (int j = 0; j < userInteger; j++)
{
Console.Write("*");
}
Console.Write("\n");
}
Thread.Sleep(1000);
Console.Clear();
/// put output into center:
for (int i = 0; i < (consoleHeight - userInteger) / 2; i++)
{
Console.Write("\n");
}
for (int j = 0; j < userInteger; j++)
{
for (int k = 0; k < (consoleWidth - userInteger) / 2; k++)
{
Console.Write(" ");
}
for (int l = 0; l < userInteger; l++)
{
Console.Write("*");
}
Console.Write("\n");
}
/// wait for a key to remove the square
Console.ReadLine();
Console.Clear();
Console.Write("\nZum Beenden bitte Eingabetaste drücken ...");
Console.ReadLine();
Console.Clear();
}
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
IxI-Enki/Uebung-031
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Stare Square
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published