Solution for Exercise 15-6

ex1506 - Windows Solution

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Press Enter to clear the screen:");
    getchar();
    system("cls");
    puts("That's better");
    return(0);
}

Notes

* The getchar() function is used here merely to pause the program. Its return value isn't used or needed.

ex1506 - Mac/Unix Solution

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Press Enter to clear the screen:");
    getchar();
    system("clear");
    puts("That's better");
    return(0);
}

Notes

* Refer tothe Notes for the Windows version of this code.