play around with indent

master
neingeist 12 years ago
parent 877471585c
commit 727938dbcf

@ -1,3 +1,8 @@
CFLAGS=-std=c99 CFLAGS=-std=c99
INDENTOPTS=-kr --no-tabs --braces-on-func-def-line --indent-level2
all: approximate-pi all: approximate-pi
.PHONY: indent
indent:
indent $(INDENTOPTS) *.c

@ -5,11 +5,11 @@ double approximate_pi(unsigned int steps) {
double approximate_pi = 4.0; double approximate_pi = 4.0;
bool subtract = true; bool subtract = true;
for(int i=2; i<=steps; i++) { for (int i = 2; i <= steps; i++) {
if (subtract) { if (subtract) {
approximate_pi -= (4.0/(i*2-1)); approximate_pi -= (4.0 / (i * 2 - 1));
} else { } else {
approximate_pi += (4.0/(i*2-1)); approximate_pi += (4.0 / (i * 2 - 1));
} }
subtract = !subtract; subtract = !subtract;
} }

Loading…
Cancel
Save