Annotation of 43BSDTahoe/usr.lib/learn/C/L17.1a, revision 1.1

1.1     ! root        1: #print
        !             2: Write in a program which reads its input and writes it
        !             3: out line numbered, with a three-digit line number (starting at one)
        !             4: followed by a single space and then by the original line.
        !             5: Note: the printf format specification %3d will print a three
        !             6: digit number.
        !             7: You might try the function fgets (part of the standard library).
        !             8:        fgets(buf, size, stdin)
        !             9: reads from the terminal ("stdin") up to size characters
        !            10: into buf.  It returns NULL on end of file.
        !            11: 
        !            12: Compile and test your program; then type "ready".
        !            13: #once #create Ref
        !            14: When in the course of human events, it becomes
        !            15: necessary for one people to dissolve the political bands which have
        !            16: connected them with another, and to assume among the 
        !            17: powers of the earth the separate and equal station to which
        !            18: the laws of Nature and of Nature's God entitle them, a decent
        !            19: respect to the opinions of mankind requires that they should
        !            20: declare the causes which impel them to the separation.
        !            21:   We hold these truths to be self evident, that all men
        !            22: are created equal, that they are endowed by their creator
        !            23: with certain unalienable rights, that among these are life, liberty,
        !            24: and the pursuit of happiness.  That to secure these rights,
        !            25: governments are instituted among men, deriving their just
        !            26: powers from the consent of the governed.  That whenever
        !            27: any form of government becomes destructive of these ends,
        !            28: it is the right of the people to alter or to abolish it, and
        !            29: to institute new government, laying its foundation on such
        !            30: principles and organizing its powers in such form, as to them
        !            31: shall seem most likely to effect their safety and happiness.
        !            32: #once #create reffed
        !            33:   1 When in the course of human events, it becomes
        !            34:   2 necessary for one people to dissolve the political bands which have
        !            35:   3 connected them with another, and to assume among the 
        !            36:   4 powers of the earth the separate and equal station to which
        !            37:   5 the laws of Nature and of Nature's God entitle them, a decent
        !            38:   6 respect to the opinions of mankind requires that they should
        !            39:   7 declare the causes which impel them to the separation.
        !            40:   8   We hold these truths to be self evident, that all men
        !            41:   9 are created equal, that they are endowed by their creator
        !            42:  10 with certain unalienable rights, that among these are life, liberty,
        !            43:  11 and the pursuit of happiness.  That to secure these rights,
        !            44:  12 governments are instituted among men, deriving their just
        !            45:  13 powers from the consent of the governed.  That whenever
        !            46:  14 any form of government becomes destructive of these ends,
        !            47:  15 it is the right of the people to alter or to abolish it, and
        !            48:  16 to institute new government, laying its foundation on such
        !            49:  17 principles and organizing its powers in such form, as to them
        !            50:  18 shall seem most likely to effect their safety and happiness.
        !            51: #user
        !            52: a.out <Ref >xxx
        !            53: #cmp xxx reffed
        !            54: #succeed
        !            55: 
        !            56: 
        !            57:  #include <stdio.h>
        !            58: 
        !            59: main()
        !            60: {
        !            61:        char s[200];
        !            62:        int k;
        !            63: 
        !            64:        k = 0;
        !            65:        while (fgets(s, 200, stdin) != NULL)
        !            66:                printf("%3d %s", ++k, s);
        !            67: }
        !            68: #log
        !            69: #next
        !            70: 18.1a 10
        !            71: 17.1c 5

unix.superglobalmegacorp.com

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