C :: Aufgabe #32 :: Lösung #1
3 Lösungen
#32
99 Bottles of Beer - Selbstständige Lösung
Anfänger - C
von pocki
- 11.01.2013 um 14:07 Uhr
Programmiere eine eigenständige Lösung zur gängigen Programmier-Übung bzw. Lied 99 Bottles of Beer
Ausgabe:
Ausgabe:
Konsolenausgabe:
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 99 bottles of beer on the wall.
98 bottles of beer on the wall, 98 bottles of beer.
... usw.
#1
von devnull (8870 Punkte)
- 18.07.2013 um 21:18 Uhr
/* bottles.c devnull,18-07-2013 */
#include <stdio.h>
#define BB1 "bottle of beer"
#define BOB "bottles of beer"
#define OTW "on the wall"
#define TOD "Take one down and pass it around"
#define GTS "Go to the store and buy some more"
/* main */
int main()
{
int n;
for (n=99;n>0;n--) {
printf("%d %s %s, %d %s.\n",n,(n==1)?BB1:BOB,OTW,n,(n==1)?BB1:BOB);
printf("%s, %d %s %s.\n",TOD,n-1,(n==2)?BB1:BOB,OTW);
}
printf("No more %s %s, no more %s.\n",BOB,OTW,BOB);
printf("%s, 99 %s %s.\n",GTS,BOB,OTW);
return 0;
}
Kommentare:
Für diese Lösung gibt es noch keinen Kommentar
Seite 1 von 0
1
