Commit | Line | Data |
---|---|---|
fd15fd37 BJ |
1 | |
2 | (Section 1.1) | |
3 | Now write a C program that prints two lines, | |
4 | the first of which says "hello" and the second | |
5 | "goodbye". Don't forget those \n delimiters. | |
6 | Compile and test it. When satisfied, | |
7 | type "ready". | |
8 | #once #create Ref | |
9 | hello | |
10 | goodbye | |
11 | #user | |
12 | a.out >test | |
13 | #cmp test Ref | |
14 | #succeed | |
15 | Here is one possible solution to compare against yours. | |
16 | ||
17 | main() | |
18 | { | |
19 | printf("hello\n"); | |
20 | printf("goodbye\n"); | |
21 | } | |
22 | ||
23 | You could also combine the two messages into one | |
24 | call to printf, like | |
25 | ||
26 | printf("hello\ngoodbye\n"); | |
27 | ||
28 | but this is harder to read at a glance. | |
29 | #log | |
30 | #next | |
31 | 1.1c 10 |