231b3679@fergvax.unl.edu (CS 231 section 2) (02/02/91)
Here's a simple (illogical) program:
#include <stdio.h>
main()
{
int i, j;
printf ("Enter your age: "); scanf("%d", &i);
printf ("Enter your weight: "); scanf("%d", &j);
printf ("\n\nQ = %d.\n", i*j); /* don't worry about Q=ij... */
}
On the VAX, this program works as expected, But when I try something like
this using Think C, the first scanf() works right, but say I entered 21 and
hit return, Think C skips over the next scanf() as if I had just hit a
blank return! To get around that, I have had to use some el-Majoro kludges,
like using gets() and atoi(). I'm using version 4.0.2, and I'm pretty sure
that when I used the updater I updated the scanf() with the patch (but
maybe not... I've reinstalled Think C so many times in the last year I
could've forgotten to apply the scanf() patch). Perhaps Phil Shapiro or
Rich Siegel could enlighten me?
--mike gleason