Article View: de.comp.lang.c++
Article #538Re: Problem-Countdown?
From: Kreikenbohm
Date: Mon, 09 Oct 1995 19:46
Date: Mon, 09 Oct 1995 19:46
33 lines
1437 bytes
1437 bytes
Hi Marco
In article <5vS4hQwd$wB@p0000328.admiral.berlinet.de>,
mac@admiral.berlinet.de (Marco Linke) wrote:
>#include <iostream.h>
>#include <conio.h>
>
>int x;
>void main ()
>{
> do {
> for (x = 10; x < 1; --x)
^^^^^ so wie laeuft die Schleife, solange
x < 1 ist. Dies ist jedoch nie der Fall (x = 10)
Damit wird die --x nie durchgefuehrt.
Es muss heissen:
for (x = 10; x >= 0; x--); // x = 10 .. 0
oder
for (x = 10; x > 0; x--); // x = 10 .. 1
> cout << endl << x;
> }
>
> while (x !=0);
^^^^^^^^^^^^^ wozu Du die do-while brauchst, weiss ich nicht.
lass sie einfach weg ;-)
> getch();
> }
>
>Das Programm soll einfach nur von 10 an rueckwรคrts zaehlen und bei null
>das Programm anhalten.
Viel Spass
Uwe
Technical Details
Message-ID:
<1995Oct9.134525.8940@fr.bosch.de>Path:
arc1-ca.pugleaf.net!fr.bosch.de!bk1384References:
<5vS4hQwd$wB@p0000328.admiral.berlinet.de>Show Full Headers
Complete Article Headers
Newsgroups: de.comp.lang.c++ Path: arc1-ca.pugleaf.net!fr.bosch.de!bk1384 From: kreiken@msmail001.bk.bosch.de (Kreikenbohm) Subject: Re: Problem-Countdown? Message-ID: <1995Oct9.134525.8940@fr.bosch.de> Sender: news@fr.bosch.de Nntp-Posting-Host: bella05.bk.bosch.de Organization: Robert Bosch GmbH X-Newsreader: News Xpress Version 1.0 Beta #4 References: <5vS4hQwd$wB@p0000328.admiral.berlinet.de> Date: Mon, 9 Oct 1995 19:46:05 GMT