tests/ex03.fw
raw| 1 | EX03: An example containing errors to do with the number of times |
| 2 | that macros are called. |
| 3 | |
| 4 | @O@<ex03.out@>==@{@- |
| 5 | @<Include Files@> |
| 6 | @<Include Files@> |
| 7 | @<Main Program@> |
| 8 | @} |
| 9 | |
| 10 | @$@<Main Program@>==@{@- |
| 11 | main() |
| 12 | { |
| 13 | doit(); |
| 14 | } |
| 15 | @} |
| 16 | |
| 17 | @$@<Subroutine@>==@{@- |
| 18 | void doit() |
| 19 | { |
| 20 | int i; |
| 21 | for (i=0;i<10;i++) |
| 22 | { |
| 23 | @<Print@> |
| 24 | @<Print@> |
| 25 | } |
| 26 | }@} |
| 27 | |
| 28 | @$@<Print@>==@{@- |
| 29 | printf("Hello World!"); |
| 30 | printf("\n");@} |
| 31 | |
| 32 | @$@<Scan@>==@{scanf@} |
| 33 | |
| 34 | @$@<Include Files@>==@{@- |
| 35 | #include <stdio.h> |
| 36 | #include <stdlib.h>@} |