summaryrefslogtreecommitdiffstats
path: root/arithmetic
diff options
context:
space:
mode:
authorhubertf <hubertf@NetBSD.org>2002-03-31 04:07:22 +0000
committerhubertf <hubertf@NetBSD.org>2002-03-31 04:07:22 +0000
commit6e60fb573fdb1b810e29a62511cde01aff5fdde5 (patch)
tree60f8cd47bc83b69969fb36bd9bdf21d6f9924446 /arithmetic
parent05a507aaa8096771a9b90f2cc460f701d05002af (diff)
downloadbsdgames-darwin-6e60fb573fdb1b810e29a62511cde01aff5fdde5.tar.gz
bsdgames-darwin-6e60fb573fdb1b810e29a62511cde01aff5fdde5.tar.zst
bsdgames-darwin-6e60fb573fdb1b810e29a62511cde01aff5fdde5.zip
The game would show the statistic info and immediately prompt you with a new
question, so you lose time, etc. Added a few lines so that it prompts to press the RETURN key to continue. Code contributed by Vic Hari <vkhr@rawsocket.net> in PR 16135
Diffstat (limited to 'arithmetic')
-rw-r--r--arithmetic/arithmetic.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/arithmetic/arithmetic.c b/arithmetic/arithmetic.c
index 45a7109e..876153a9 100644
--- a/arithmetic/arithmetic.c
+++ b/arithmetic/arithmetic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: arithmetic.c,v 1.17 2001/02/19 22:41:45 cgd Exp $ */
+/* $NetBSD: arithmetic.c,v 1.18 2002/03/31 04:07:22 hubertf Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: arithmetic.c,v 1.17 2001/02/19 22:41:45 cgd Exp $");
+__RCSID("$NetBSD: arithmetic.c,v 1.18 2002/03/31 04:07:22 hubertf Exp $");
#endif
#endif /* not lint */
@@ -94,7 +94,7 @@ int main __P((int, char *[]));
int opnum __P((int));
void penalise __P((int, int, int));
int problem __P((void));
-void showstats __P((void));
+void showstats __P((int));
void usage __P((void)) __attribute__((__noreturn__));
const char keylist[] = "+-x/";
@@ -155,7 +155,7 @@ main(argc, argv)
for (cnt = NQUESTS; cnt--;)
if (problem() == EOF)
exit(0);
- showstats();
+ showstats(0);
}
/* NOTREACHED */
}
@@ -165,13 +165,14 @@ void
intr(dummy)
int dummy __attribute__((__unused__));
{
- showstats();
+ showstats(1);
exit(0);
}
/* Print score. Original `arithmetic' had a delay after printing it. */
void
-showstats()
+showstats(bool_sigint)
+ int bool_sigint;
{
if (nright + nwrong > 0) {
(void)printf("\n\nRights %d; Wrongs %d; Score %d%%",
@@ -180,6 +181,10 @@ showstats()
(void)printf("\nTotal time %ld seconds; %.1f seconds per problem\n\n",
(long)qtime, (float)qtime / nright);
}
+ if(!bool_sigint) {
+ (void)printf("Press RETURN to continue...\n");
+ while(!getchar()) ;
+ }
(void)printf("\n");
}