author | Rodrigo Campos
<rodrigo@sdfg.com.ar> 2010-09-05 23:37:59 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2010-09-06 21:26:42 UTC |
parent | 9c68c71fd8654f32135e2d8b11e6fdea3011b665 |
babilonio.cpp | +6 | -5 |
diff --git a/babilonio.cpp b/babilonio.cpp index 54e21e2..d179cac 100644 --- a/babilonio.cpp +++ b/babilonio.cpp @@ -4,20 +4,21 @@ #include <stdint.h> #include "aritmetica.hpp" -#define APROX 2 - int main(int argc, char *argv[]) { - if (argc != 3) { - printf("Uso: %s <prec> <niters>\n", argv[0]); + if (argc != 3 && argc != 4) { + printf("Uso: %s <prec> <niters> [aprox]\n", argv[0]); return 1; } + int aprox = 2; int prec = atoi(argv[1]); int niters = atoi(argv[2]); + if (argc == 4) + aprox = atoi(argv[3]); /* Valores iniciales */ - numero n0(prec, APROX); + numero n0(prec, aprox); numero n1 = n0; /* Loop de la sucesion, niters veces */