Sprache: C#
Diese Funktion schreibt einen string zentriert in die Konsole und macht einen Absatz.
public static void WriteCenter(string text)
{
System.Console.SetCursorPosition(System.Console.WindowWidth/2 - text.Length / 2, System.Console.CursorTop);
Console.WriteLine(text);
}
public static void WriteCenter(string text)
{
System.Console.SetCursorPosition(System.Console.WindowWidth/2 - text.Length / 2, System.Console.CursorTop);
Console.WriteLine(text);
}
Alte URL:
/snippet/text-zentriert-in-die-konsole-schreiben/1121