home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beginning C++ Through Gam…rogramming (2nd Edition)
/
BCGP2E.ISO
/
source
/
chapter02
/
finicky_counter.cpp
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
2003-10-21
|
363 bÂ
|
26 lines
// Finicky Counter
// Demonstrates break and continue statements
#include <iostream>
using namespace std;
int main()
{
int count = 0;
while (true)
{
count += 1;
//end loop if count is greater than 10
if (count > 10)
break;
//skip the number 5
if (count == 5)
continue;
cout << count << endl;
}
return 0;
}