diff --git a/c02_overview/fathm_ft.c b/c02_overview/fathm_ft.c new file mode 100644 index 0000000..36a8ffb --- /dev/null +++ b/c02_overview/fathm_ft.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +int main(void) +{ + int feet, fathoms; + + fathoms = 2; + feet = 6 * fathoms; + printf("There are %d feet in %d fathoms!\n", feet, fathoms); + printf("Yes, I said %d feet!\n", 6 * fathoms); + + return 0; +} \ No newline at end of file diff --git a/c02_overview/first.c b/c02_overview/first.c new file mode 100644 index 0000000..42a0f38 --- /dev/null +++ b/c02_overview/first.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +int main(void) +{ + int num; + num = 1; + + printf("I am a simple "); + printf("computer.\n"); + printf("My favorite number is %d because it is first.\n", num); + + return 0; +} \ No newline at end of file diff --git a/c02_overview/test01.c b/c02_overview/test01.c new file mode 100644 index 0000000..7b5e7d5 --- /dev/null +++ b/c02_overview/test01.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +int main(void) +{ + printf("Gustav Mahler\n"); + printf("Gustav\nMahler\n"); + printf("Gustav "); + printf("Mahler\n"); + return 0; +} \ No newline at end of file diff --git a/c02_overview/test03.c b/c02_overview/test03.c new file mode 100644 index 0000000..d95a0fe --- /dev/null +++ b/c02_overview/test03.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +int main(void) +{ + int age = 40; + int days = age * 365; + printf("今年%d岁,活了%d多天了\n", age, days); + return 0; +} \ No newline at end of file diff --git a/c02_overview/test04.c b/c02_overview/test04.c new file mode 100644 index 0000000..dba5ce1 --- /dev/null +++ b/c02_overview/test04.c @@ -0,0 +1,23 @@ +#include <stdio.h> + +void jolly(void); +void deny(void); + +int main(void) +{ + jolly(); + jolly(); + jolly(); + deny(); + return 0; +} + +void jolly(void) +{ + printf("For he's a jolly good fellow!\n"); +} + +void deny(void) +{ + printf("Which nobody can deny!\n"); +} \ No newline at end of file diff --git a/c02_overview/two_func.c b/c02_overview/two_func.c new file mode 100644 index 0000000..1f6e234 --- /dev/null +++ b/c02_overview/two_func.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +void butler(void); + +int main(void) +{ + printf("I will summon the butler function.\n"); + butler(); + printf("Yes. Bring me some tea and writeable DVDs.\n"); + + return 0; +} + +void butler(void) +{ + printf("You rang, sir?\n"); +} \ No newline at end of file