diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8b9e5a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.out +*.o +*.a +*.swp + +#Because I'm not using gcc or csh. +book_code/unix-xwindows/gccx diff --git a/ch1/simple_io.c b/ch1/simple_io.c new file mode 100644 index 0000000..5227f5e --- /dev/null +++ b/ch1/simple_io.c @@ -0,0 +1,19 @@ +#include +#include "../book_code/unix-xwindows/genlib.h" +#include "../book_code/unix-xwindows/simpio.h" + +int main() { + double n1, n2, n3, average; + + printf("This program averages three numbers.\n"); + printf("1st number: "); + n1 = GetReal(); + printf("2nd number: "); + n2 = GetReal(); + printf("3rd number: "); + n3 = GetReal(); + average = (n1 + n2 + n3) / 3; + printf("The average is %g\n", average); + + return 0; +} diff --git a/roberts_clang b/roberts_clang new file mode 100755 index 0000000..5dbed2a --- /dev/null +++ b/roberts_clang @@ -0,0 +1,5 @@ +#! /usr/bin/env sh +INCLUDE=/home/matt/dev/c/roberts_abstractions/book_code/unix-xwindows +CSLIB=$INCLUDE/cslib.a +LIBRARIES="$CSLIB -lX11 -lm" +clang -I$INCLUDE $* $LIBRARIES