home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / MASTER-1.ZIP / SOURCE / CHAP03 / DEMOCPP.C
C/C++ Source or Header  |  1992-06-12  |  486b  |  25 lines

  1. /* DEMOCPP.C
  2.    Demonstrates the usage of the CPP preprocessor.
  3. */
  4. #include <stdio.h>
  5.  
  6. #define prompt1 "Good, Morning"
  7. #define prompt2 "Good, Afternoon"
  8.  
  9. /* Use this for conditional compilation */
  10. #define useprompt1 1
  11.  
  12. /* Illustrate macro expansion */
  13. #define sumit(a,b,c) ( (a) + (b) + (c) )
  14.  
  15. void main( void )
  16. {
  17. #ifdef useprompt1
  18.   printf("%s\n", prompt1);
  19. #else
  20.   printf("%s\n", prompt2);
  21. #endif
  22.  
  23.   printf("The sum of 7 + 9 + 11 is: %d\n", sumit(7,9,11) );
  24.  
  25. }