diff options
Diffstat (limited to 'wk5/pset/inheritance')
-rw-r--r-- | wk5/pset/inheritance/inheritance.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/wk5/pset/inheritance/inheritance.c b/wk5/pset/inheritance/inheritance.c index d973b67..7e5916a 100644 --- a/wk5/pset/inheritance/inheritance.c +++ b/wk5/pset/inheritance/inheritance.c @@ -1,10 +1,10 @@ // Simulate genetic inheritance of blood type +#include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <math.h> // Each person has two parents and two alleles typedef struct person @@ -112,11 +112,13 @@ void print_family(person *p, int generation) // Print person if (generation == 0) { - printf("Child (Generation %i): blood type %c%c\n", generation, p->alleles[0], p->alleles[1]); + printf("Child (Generation %i): blood type %c%c\n", generation, p->alleles[0], + p->alleles[1]); } else if (generation == 1) { - printf("Parent (Generation %i): blood type %c%c\n", generation, p->alleles[0], p->alleles[1]); + printf("Parent (Generation %i): blood type %c%c\n", generation, p->alleles[0], + p->alleles[1]); } else { @@ -124,7 +126,8 @@ void print_family(person *p, int generation) { printf("Great-"); } - printf("Grandparent (Generation %i): blood type %c%c\n", generation, p->alleles[0], p->alleles[1]); + printf("Grandparent (Generation %i): blood type %c%c\n", generation, p->alleles[0], + p->alleles[1]); } // Print parents of current generation |