Annotation of coherent/d/usr/src/examples/scanf.c, revision 1.1.1.1

1.1       root        1: #include <stdio.h>
                      2: 
                      3: main()
                      4: {
                      5:        int left, right;
                      6: 
                      7:        printf("No. of fingers on your left hand:  ");
                      8:        /* force message to appear on screen */
                      9:        fflush(stdout);
                     10:        scanf("%d", &left);
                     11: 
                     12:        /* eat newline char */
                     13:        while(getchar() != '\n');
                     14: 
                     15:        printf("No. of fingers on your right hand:  ");
                     16:        fflush(stdout);
                     17:        scanf("%d", &right);
                     18: 
                     19:        /* again, eat newline */
                     20:        while(getchar() != '\n');
                     21: 
                     22:        printf("You've %d left fingers, %d right, & %d total\n",
                     23:                left, right, left+right);
                     24: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.