Solution for Exercise 10-3

ex1003

#include <stdio.h>

//void prompt(void);        /* function prototype */

int main()
{
    int loop;
    char input[32];

    loop=0;
    while(loop<5)
    {
        prompt();
        fgets(input,32,stdin);
        loop=loop+1;
    }
    return(0);
}

/* display prompt */

void prompt(void)
{
    printf("C:\\DOS> ");
}

Output

(None.)

Notes

* I chose to use the // technique to comment out Line 3. It works better for commenting out a single line. Even if you used /* it wouldn't mess up the comment at the end of the line, though some text editors may balk at the extra /* in the comment.