Files
VCCPlusOSS/examples/cmoc/planet.c
T

30 lines
730 B
C

/* Earth or Mars -- one key chooses the greeting on a 40-column CoCo 3. */
#include <cmoc.h>
#include <coco.h>
int main(void)
{
byte choice;
width(40);
printf("What planet do you live on?\n1) Earth\n2) Mars\n");
do
{
choice = inkey(); /* No Enter needed. Ignore other keys. */
} while (choice != '1' && choice != '2');
attr(3, 6, FALSE, FALSE); /* White text on background slot 6. */
if (choice == '1')
{
palette(6, 10); /* Blue */
printf("Hello Nice Blue Dot World!\n");
}
else
{
palette(6, 37); /* Red */
printf("Hello Cold Red Dot World!\n");
}
attr(0, 0, FALSE, FALSE); /* Back to BASIC's usual colors. */
return 0;
}