/*
Statements to the Pre-processor.
*/
#include <stdio.h>
#define true 1 /* Defining "true" as a constant equal to 1 */
main()
{
/* Declaration statements */
short age, pds;
double grams, days;
char name[21], adrs[21];
int single; /* Really treated as a logical/boolean
False=0 True=1 or any other value */
printf("C21.C -> This program shows how pre-processor directives work,\n");
printf("and one way of doing logical/boolean operations in C\n");
/* Executable statements */
age = 19;
pds = 105;
grams = pds * 454.0;
days = age * 365.25;
strcpy(name, "Jane Simpson");
strcpy(adrs, "123 Main Street");
single = true;
/* Printing statements */
printf("Name : %s\nAddress: %s\n", name, adrs);
printf("Age : %d\nDays :%8.2f\n", age, days);
printf("PDS : %d\nGRAMS : %7.1f\n", pds, grams);
printf("Single : ");
puts(single ? "TRUE" : "FALSE");
getch();
return(0);
}
/* End of Program C21 */
/*
OUTPUT :
C21.C -> This program shows how pre-processor directives work, and one way of doing logical/boolean operations in C Name : Jane Simpson Address: 123 Main Street Age : 19 Days : 6939.75 PDS : 105 GRAMS : 47670.0 Single : TRUE */
Last modified: 21/07/97