![]() |
Re: Sternchenmuster erstellen
Hier ist noch eine möglichkeit von mir:
Delphi-Quellcode:
program dreieck_links;
{$APPTYPE CONSOLE} uses SysUtils; var max: Byte; procedure DrawStars(anz: Byte); var Stars: String; begin Stars:=StringOfChar(' ', (max-anz) div 2) + StringOfChar('*', anz); WriteLn(Stars); if anz>1 then begin DrawStars(anz-2); WriteLn(Stars); end; end; begin Write('Wieviel Sterne: '); ReadLn(max); // Wir brauchen eine ungerade Anzahl, dass wir in der Mitte einen Stern bekommen if max mod 2 = 0 then Inc(max, 1); DrawStars(Max); ReadLn; end. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:17 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz