home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / datafiles / text / c_tutor / macro.c < prev    next >
C/C++ Source or Header  |  1995-02-27  |  469b  |  18 lines

  1. #define WRONG(A) A*A*A      /* Wrong macro for cube */
  2. #define CUBE(A) (A)*(A)*(A) /* Right macro for cube */
  3. #define SQUR(A) (A)*(A)     /* Right macro for square */
  4. #define START 1
  5. #define STOP  9
  6.  
  7. main()
  8. {
  9. int i,offset;
  10.  
  11.    offset = 5;
  12.    for (i = START;i <= STOP;i++) {
  13.       printf("The square of %3d is %4d, and its cube is %6d\n",
  14.               i+offset,SQUR(i+offset),CUBE(i+offset));
  15.       printf("The wrong of  %3d is %6d\n",i+offset,WRONG(i+offset));
  16.    }
  17. }
  18.