From 2ec9ff05a6d2fe2c0493c4265b8af5250e0011c3 Mon Sep 17 00:00:00 2001 From: cuz Date: Sat, 13 Oct 2001 15:45:04 +0000 Subject: [PATCH] Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@1050 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- samples/sieve.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/samples/sieve.c b/samples/sieve.c index e04fc6fca..d20ef8b95 100644 --- a/samples/sieve.c +++ b/samples/sieve.c @@ -62,21 +62,21 @@ int main (void) /* Calculate the time used */ Ticks = clock() - Ticks; - /* Print the time used and wait for a key */ + /* Print the time used */ printf ("Time used: %lu ticks\n", Ticks); printf ("Press Q to quit, any other key for list\n"); - if (toupper (cgetc()) == 'Q') { - exit (EXIT_SUCCESS); - } - - /* Print the result */ - for (I = 2; I < COUNT; ++I) { - if (Sieve[I] == 0) { - printf ("%4d\n", I); - } - if (kbhit() && toupper (cgetc()) == 'q') { - break; - } + + /* Wait for a key and print the list if not 'Q' */ + if (toupper (cgetc()) != 'Q') { + /* Print the result */ + for (I = 2; I < COUNT; ++I) { + if (Sieve[I] == 0) { + printf ("%4d\n", I); + } + if (kbhit() && toupper (cgetc()) == 'Q') { + break; + } + } } return EXIT_SUCCESS; -- 2.39.5