Commit 528fbab7 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Updated ass7 usage.

parent 14aeba10
/*
* Usage: ./q7 [ generations [ max_age ] ]
*/
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
...@@ -87,14 +83,17 @@ void sequence_old(int n) { ...@@ -87,14 +83,17 @@ void sequence_old(int n) {
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
int max_age = 0, generations = 10; int max_age = 0, generations;
if( argc < 2 ) {
printf("Usage: %s GENERATIONS [ MAX_AGE ]\n", argv[0]);
return 1;
}
if( argc > 1 ) {
generations = atoi(argv[1]); generations = atoi(argv[1]);
if( argc > 2 ) if( argc > 2 )
max_age = atoi(argv[2]); max_age = atoi(argv[2]);
}
sequence(generations, max_age); sequence(generations, max_age);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment